Card Sections
Demo URL: https://diviwp.com/ui/sections/card-sections/all-card-sections/
A Card is a User Interface (UI) design pattern that organises and groups content or information in an easily scannable manner. These specific chunks of information mimic a physical card-like appearance which users appreciate because it aids for scannability. Users don’t read, they scan.
We’ve designed a range of Card Sections which include individual blurb cards, row cards and column cards. They use a combination of Image, Blurb, Text and Button modules to present content in a cognitively-friendly way because the user doesn’t have to exert effort reading vast amounts of text and can process information faster.
They’re also beautifully responsive and can be used in a range of contexts on a variety of page designs.
There are 45 Card Sections to explore.
Editing the demo content
Each DiviWP Card Section can be edited using the Visual Builder.
You can make your changes to various module settings, upload new images, change colors, toggle between the desktop, tablet and mobile views and publish your page to achieve the look in the demo.
In some sections outlined below, Custom CSS is necessary to achieve a desired affect or an optimal responsive user experience and where the Divi Builder was unable to do it with it's Module settings alone.
Why Custom CSS is used in Sections
Divi is an incredible builder and you can certainly do a ton of things with its built-in settings.
We're sure we'll see the introduction of even more new settings in time, but for now, we believe it does not (yet) have the ability to configure the necessary settings to create a particular interface design or effects.
So by including Custom CSS in a seperate Code Module or labeled within the Row, Column or Module, you can learn how we've used various CSS properties to achieve a desired effect.
How to view Custom CSS
When you are editing in the Visual Mode and building on the front-end of your website, Custom CSS Code Modules or Custom CSS configured within a Row, Column or Module is not visible.
Accessing the Layer View or Wireframe mode gives you access to your page and section structure, displaying all elements in an organized, nested hierarchy list that clearly showcases your page structure. Learn more about Layer View and Wireframe mode.
Custom CSS in use in sections (scroll down for in-depth documentation)
- Card Sections 1 - 20 All use the same custom CSS
- Custom CSS Module
- Card Section 45
- Custom CSS Module
Related documentation:
- Can I edit Module labels?
- Can I modify Layouts or Sections?
- Custom CSS - How and Why It's Used in Sections
- How are admin labels used in Sections, Rows, Columns and Modules?
- What if I don't want to use any Custom CSS?
Support is always on hand
You can rest assured that support is always on-hand and we'll be able to guide you as far as possible should you require assistance with any custom CSS we have included in our layouts, templates or sections.
Card Sections 1 - 20 and 45
Card Sections 1 - 20 as well as 45 use the same Custom CSS Module to create the card design. Let's use the following as an example:
Let's look at the above section via the Layer View below.
You can read more about admin labels by reviewing the following documentation: How are admin labels used in Sections, Rows, Columns and Modules?
Firstly, notice how the second Column has the following label: Column .diviwp-col-flex
This means the Column has a custom class called diviwp-col-flex which is set via the Column Settings → Advanced → CSS ID and Classes:
Secondly, notice how the Image module has the following label: Image .diviwp-listing-height-100 500x500
This means the Image module has a custom class of diviwp-listing-height-100 set via Image Module Settings → Advanced → CSS ID and Classes. The 500x500 is an example image resolution you could use to replace the image.
Now that we've established the class names for the Column and the Image, we can review the Code Module: CSS Code for diviwp-listing-height-100 to maintain image 100% height to parent column
This means the Custom Code module has CSS properties which are targeting the class diviwp-listing-height-100, set for the Image Module as outlined above, as well as a brief description of what this does.
In this instance, the code in the module is making the Image Module stretch proportionately to fill 100% of the vertical space of the column it is positioned in.
- This does not produce a new image file, it merely uses an aspect-ratio friendly CSS trick for tablet and mobile breakpoints.
- The code does not degrade the image in anyway and the original quality is maintained.
- This may result in some cropping of your image if you upload square images as per the live demo
This means the "Card" interface is maintained at various browser sizes. Here is an example of this when testing the responsiveness of the Section.
Of course you might want to see what happens without the Custom Code Module.
Here's a screenshot what it looks like without the Custom CSS Code Module:
It's passable but it's not ideal which is why we've provided the Custom CSS to create our desired Card UI.
This is why Custom CSS is only used in places where it is necessary to achieve a desired affect or an optimal responsive user experience and where the Divi Builder was unable to do it alone.
Alternative to using a Custom CSS Code module:
A few alternative solutions you might be interested in or want to try yourself:
- Upload different images for Desktop, Tablet and Mobile views in the builder.
- We don't like this solution because it triples the amount of work you're doing for yourself, having to create the images and then upload them individually for each change.
- Duplicate the row and make the "Desktop" row invisible and the "Tablet" row visible.
- We don't like how this solution doubles your time to make a change. Any change you make to the first row, you'll have to remember to make for the second. We like striving for a "single source of truth" as far as possible.
- Use the image as a background image of it's parent column and leave the column empty
- The card design in the template is optimised for usability so the ability to click on the image is important. You can't click on background images.
You might say that you can set the column to be clickable which would "mimic" the same effect as having a clickable image. This is true and is an alternative option, however, setting the background image in the column is not an intuitive editing experience for users who might be updating the layout on a regular basis. There are also SEO sacrifices such as the background image not being indexed for Google Image.
Can I move the CSS in the Custom CSS Code Module into Divi's Theme Options or my own Child Theme?
Of course!
All you'd need to do is copy the contents of the custom css code module and paste them into one of the options:
- Divi's Theme Options: Admin Dashboard → Divi → Theme Options (scroll down to Custom CSS box)
- Your Child Theme: via editing your styles.css file
Just remember to delete the opening and closing <style> tags or <script> tags if you're moving any custom javascript.
Support is always on hand
You can rest assured that support is always on-hand and we'll be able to guide you as far as possible should you require assistance with any custom CSS we have included in our layouts, templates or sections.