One in all Drupal Development Service hottest parts on any web site I’ve labored on is Drupal Development Service card element. Relying on Drupal Development Service web site, Drupal Development Service card element is used to group varied items of content material right into a container which can be utilized all through your web site. Right here’s an instance of a card element in certainly one of our tasks.In some situations, a card generally is a person profile, content material teaser/excerpt, newest information or occasions. At present we are going to construct a card element which can include Drupal Development Service data for Drupal Development Service newest occasions. This card can be utilized in Drupal Development Service /occasions web page to record all Drupal Development Service newest occasions going down. Drupal Development card may also be utilized in different pages and it might have to be displayed barely completely different than Drupal Development Service unique card, this transformation is named “variations” and is normally achieved by passing a modifier CSS class to Drupal Development Service unique element which we are able to use to write down completely different types for Drupal Development Service card. Extra on this later.Let’s get startedFirst, let’s check out what we’re constructing so we have now a visible of Drupal Development Service code we shall be writing. As you possibly can see from Drupal Development Service photographs above, our card takes completely different shapes however Drupal Development Service data in it stays Drupal Development Service similar or comparable. It is a frequent apply to change parts primarily based on the place and the way they’re being displayed.Let’s construct Drupal Development Service cardIdentify element’s fieldsBefore beginning to write any code, let’s take an in depth have a look at Drupal Development Service card photographs to determine Drupal Development Service fields or knowledge components Drupal Development Service card wants. From Drupal Development Service photographs above we are able to see Drupal Development Service following fields shall be wanted Drupal 10 Upkeep and Assist ServiceImage Title Subtitle Excerpt Label or class Label for feedback Label for time posted Usually, parts are constructed following Drupal Development Service Atomic Design method which mainly means breaking issues down into small items (atoms) after which combining these items to construct extra elaborate parts.In Drupal Development Service curiosity of time, we’re going to skip constructing each bit as its separate element and as an alternative we are going to construct Drupal Development Service card as a complete. I just lately wrote a weblog put up on constructing versatile headings which reveal Drupal Development Service method I normally take when constructing parts.Architecting Drupal Development Service element fieldsWe know Drupal Development Service fields we’d like however it’s useful to find out what sort of fields they’re and what they are going to be referred to as. Drupal Development desk under offers us a superb visible of our fields structure. Writing Drupal Development Service code1. In your parts or patterns listing in your mission, create a brand new folder referred to as `card`2. Inside Drupal Development Service Card folder create two new recordsdata – card.html – card.css (we’re utilizing CSS to maintain issues easy. Be happy to make use of Sass if you would like).3. In your card.html we’ll begin with Drupal Development Service fundamental construction of Drupal Development Service card<article class=”card”>…</article>So we have created an article tag as Drupal Development Service card’s container. Why <article> and never <div>? Effectively, since Drupal Development Service card is meant to include an occasion’s information, if we place a bunch of playing cards collectively it is smart that every card is a person occasion article.4. Subsequent we’re going to create wrappers for Drupal Development Service two kinds of knowledge Drupal Development Service card will maintain. Drupal Development two kinds of knowledge as we have now seen from Drupal Development Service desk above are Drupal 10 Upkeep and Assist Service Picture/media and textual content or content material. Let’s modify our code so it seems like this Drupal 10 Upkeep and Assist Service<article class=”card”> <div class=”card__media”>…</div> <div class=”card__content”>…</div> </article>Drupal Development purpose for splitting Drupal Development Service picture and Drupal Development Service remainder of Drupal Development Service content material is that this enables us to maneuver issues round independently of one another to create completely different variations of Drupal Development Service card. Extra on this later.Let’s pause to overview how content material shall be laid outIf we have a look at Drupal Development Service card photographs above, we see that a few of Drupal Development Service fields are both on Drupal Development Service picture aspect and others are grouped collectively separate from Drupal Development Service picture. Though we may probably place fields in Drupal Development Service picture or content material wrappers, it is smart to put them in Drupal Development Service wrapper the place they visually seem.For instance, Drupal Development Service date and label fields (Photographs), seem like they belong in Drupal Development Service similar group as Drupal Development Service picture. Drupal Development remainder of Drupal Development Service fields will go in Drupal Development Service Content material wrapper.5. Let’s begin with Drupal Development Service picture wrapper Drupal 10 Upkeep and Assist Service<article class=”card”> <div class=”card__media”> <img src=”http Drupal 10 Upkeep and Assist Service//placehold.it/300×300″ alt=”Card picture” /> <div class=”card__date”> <span class=”date–day”>27</span> <span class=”date–month”>Mar</span> </div> <span class=”card__category”>Photographs</span> </div> <div class=”card__content”>…</div> </article>So let’s focus in Drupal Development Service fields inside card__media. We see we have now our picture, which on this case is rendering a placeholder picture. Then we have now a wrapper to carry Drupal Development Service date fields (day and month). Once more, wrapping these two collectively makes it simple to control them as a single merchandise moderately than two separate fields. Lastly, we have now Drupal Development Service class for this content material (Photographs). Since all these fields appear to belong collectively, it is smart to put them Drupal Development Service approach we have now. Afterward, we are going to use CSS to put every of Drupal Development Service fields of their proper place.6. Now let’s place Drupal Development Service remaining fields inside Drupal Development Service .card__content wrapper. We are going to briefly conceal Drupal Development Service fields in Drupal Development Service .card__media wrapper to give attention to Drupal Development Service different fields. Modify your markup to seem like this Drupal 10 Upkeep and Assist Service<article class=”card”> <div class=”card__media”>…</div> <div class=”card__content”> <header class=”card__header”> <h2 class=”card__title”>Metropolis Lights in New York</h2> <div class=”card__subtitle”>Drupal Development metropolis that by no means sleeps</div> </header> <p class=”card__excerpt”>New York, Drupal Development Service largest metropolis in Drupal Development Service U.S., is an architectural marvel with loads of historic monuments, magnificent buildings and numerous dazzling skyscrapers.</p> <footer class=”card__meta” position=”contentinfo”> <span class=”card__post-date”>6 min in the past</span> <span class=”card__comments”>39 feedback</span> </footer> </div> </article>So Drupal Development Service very first thing we did was add a `<header>` tag to wrap Drupal Development Service title and subtitle fields. Drupal Development header tag is an effective way to point Drupal Development Service position content material performs in our element. As well as, utilizing semantically appropriate markup makes this element search engine marketing pleasant in addition to accessible. Subsequent we have now Drupal Development Service teaser content material wrapped in a <p> tag and at last, we add one other semantic tag which is `footer` to wrap Drupal Development Service publish date and feedback fields.Why this markup?I might prefer to carry up a few issues to your consideration concerning how I arrived at Drupal Development Service markup above. First, we’re utilizing BEM for naming CSS courses (card__title, card__comments, and so forth.). BEM is nice for creating associations in your element fields. By Drupal Development Service markup the place every subject belongs. This makes it simpler to determine the place you’d discover Drupal Development Service types or different belongings for Drupal Development Service element inside your mission when you might have tons and tons of parts. Drupal Development class card and all Drupal Development Service different subject courses are distinctive not solely to this element however in Drupal Development Service total mission. This offers us Drupal Development Service peace of thoughts that our types is not going to inadvertently have an effect on different areas of Drupal Development Service web site.Discover I created two containers inside Drupal Development Service card (`card__media` and `card__content`). This enables me to separate Drupal Development Service card content material into teams I can manipulate individually and independently of one another. This may turn out to be useful when we have to create a protracted or broad card. As well as, by grouping a number of fields right into a single container it’s simpler to control Drupal Development Service fields with CSS as a bunch moderately than individually.Atomic DesignIf you might be accustomed to Atomic Design, Drupal Development Service advisable approach for constructing parts is to interrupt issues down into Drupal Development Service smallest items potential. For instance, in Drupal Development Service card construction above, every of Drupal Development Service fields that make up Drupal Development Service card can truly be its personal particular person element. Then we might mix all of them into a complete new element (card). In Drupal Development Service curiosity of time/work, I’m not breaking Drupal Development Service card element into atoms. Nonetheless, if I had been constructing Drupal Development Service card for a mission I’d positively try this as this enables for parts to be reused and save time/work in Drupal Development Service lengthy street.Placing Drupal Development Service total card togetherNow that we have now constructed each bit of Drupal Development Service card, your **card.thml** file ought to seem like this Drupal 10 Upkeep and Assist Service<article class=”card”> <div class=”card__media”> <img src=”http Drupal 10 Upkeep and Assist Service//placehold.it/300×300″ alt=”Card picture” /> <div class=”card__date”> <span class=”date–day”>27</span> <span class=”date–month”>Mar</span> </div> <span class=”card__category”>Photographs</span> </div> <div class=”card__content”> <header class=”card__header”> <h2 class=”card__title”>Metropolis Lights in New York</h2> <div class=”card__subtitle”>Drupal Development metropolis that by no means sleeps</div> </header> <p class=”card__excerpt”>New York, Drupal Development Service largest metropolis in Drupal Development Service U.S., is an architectural marvel with loads of historic monuments, magnificent buildings and numerous dazzling skyscrapers.</p> <footer class=”card__meta” position=”contentinfo”> <span class=”card__post-date”>6 min in the past</span> <span class=”card__comments”>39 feedback</span> </footer> </div> </article>Card StylesNow that we have now Drupal Development Service markup prepared for Drupal Development Service card element, we are able to start writing our Sass/CSS to model it. I’m not going to enter element about Drupal Development Service types as I’ve commented Drupal Development Service components that will want some rationalization and must be simple to know. Drupal Development foremost take away from writing types for parts with distinctive names is that there’s little to no CSS nesting. This makes overriding types a simple process if there’s ever a necessity to take action. As well as, types written for a element like this, do not run into Drupal Development Service danger of leaking into different areas of Drupal Development Service web site.Obtain Drupal Development Service types from this gist to make Drupal Development Service element look good. That is lots of CSS but it surely’s all essential to realize Drupal Development Service appear and feel of Drupal Development Service card. You will need to know that your markup file (card.html), must reference your types file (card.css) for issues to work. This can be apparent however in case you are following alongside that is an additional step that must be completed. Making a card variationIf you wish to see Drupal Development Service card displayed broad or horizontally, modify your card wrapper to seem like this Drupal 10 Upkeep and Assist Service<article class=”card card–wide”>…</article> Discover that by passing Drupal Development Service CSS class of `card–wide` to Drupal Development Service unique card element we’re capable of change Drupal Development Service orientation of Drupal Development Service card from lengthy to broad giving us an alternate variation to make use of with out having to rebuild Drupal Development Service card from scratch. These variations are fairly highly effective and current many benefits.For those who have a look at Drupal Development Service types, you’ll discover there’s a block of CSS wherein Drupal Development Service card–wide is modified to maneuver Drupal Development Service card’s content material to Drupal Development Service proper of Drupal Development Service picture. It is a wonderful means to offer different views of a element with out having to recreate Drupal Development Service markup or types for a element.In closingBuilding parts is certainly one of my favourite issues to do as a developer and there are various benefits to this model of theming. It is vital to assume by way of how parts shall be used so you possibly can plan forward methods to greatest construct a element that may be reused. Dashing by way of constructing parts with out having a full understanding of the place and the way a element could also be used can result in duplicating code or redoing your work to accommodate new mission necessities. Drupal 10 Growth and Assist
Drupal 10 Assist: Drupal 10 Upkeep and Assist Service How you can Construct a Card Element

Call Us: 1(800)730-2416
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit
Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)
Drupal 10 Assist: Drupal 10 Upkeep and Assist Service How you can Construct a Card Element
On-Site Drupal SEO Master Setup
We make sure your site is 100% optimized (and stays that way) for the best SEO results.
With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.
This service includes:
- Pathauto install and configuration for SEO-friendly URLs.
- Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
- Install and fix all issues on the SEO checklist module.
- Install and configure XML sitemap module and submit sitemaps.
- Install and configure Google Analytics Module.
- Install and configure Yoast.
- Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
- Install and configure Schema.org Metatag.
- Configure robots.txt.
- Google Search Console setup snd configuration.
- Find & Fix H1 tags.
- Find and fix duplicate/missing meta descriptions.
- Find and fix duplicate title tags.
- Improve title, meta tags, and site descriptions.
- Optimize images for better search engine optimization. Automate where possible.
- Find and fix the missing alt and title tag for all images. Automate where possible.
- The project takes 1 week to complete.
