Log In Sign Up
HomeDocsListCard Section

Card Section

Category: List
The card is used to display mixed content of images and text, in pure CSS form, and can be used with any layout, such as flex or grid.

Basic Structure

A card mainly consists of a cover image and main content, with the following basic HTML structure:

                      
                        <div class="_card">
                            <a rep="poster">
                                <img/>
                            </a>
                            <div class="_card-body">
                                <div rep="title"></div>
                            </div>
                            <div class="_card-foot"></div>
                        <div>
                    
                

Single Image with Text

Card lists are typically implemented using grid layout.

  • rep=poster indicates the cover image container
  • rep=title indicates the title container
  • Both rep=poster node and _card-foot node can be omitted

Multiple Text with Image

In addition to rep=title, text blocks can also include rep=brief and rep=byline as needed. If the title needs ellipsis handling, use _ell related styles.

For single-line or multi-line text ellipsis usage, click here to view.

  • Output
  • HTML

The footer node only contains margin-top properties. If users need to customize footer content, they can place any elements inside _card-foot.

  • Output
  • HTML

Using Tags

Since the cover image occupies a large area, you can place tags such as oc-flag, oc-badge and oc-bouy.

  • Output
  • HTML

Using Buttons

Users can customize footer content or use built-in button group tags.

  • rep=btns indicates button groups, wrapped by _card-foot node, aligned to the bottom of the card

Without Paddings

The list has padding and borders by default. We can remove borders to better integrate with other components.

Custom Image Ratio

The core of card is the large image. We can control the image ratio through CSS variable --_card-ar (ar=aspect-ratio). Default ratio is 16:9.

Multiple Images

Use rep=posters attribute tag to display image galleries. Place the photo wall component _wall inside the tag.

New Launch: 20% Off All Products

Unlock all examples and development resources