Cards


Cards are one of most popular components. These are very flexible "content containers" with extensible options for headers, footers, images, and a wide variety of content.

Basic example

This is a simple card with a title, text, and button.

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

You already know most of these classes from previous lessons. The card is a simple component and there is not much to explain here.

What may be noticeable, especially if you've used libraries like Bootstrap before, is that we don't have classes like .card or .card-body here. The entire card is composed of utilities classes, and shadows are added using arbitrary values.

And since we're using a ripple effect button in the card, we also need to add a piece of Ripple initialization JavaScript in our project. You already know it too from the previous lesson.

Card with an image

You can very easily add an image to your card by adding a plain <img> element, wrapped within <a> element (to be clickable). Notice that we need to add .rounded-t-lg class to the image, to add rounded corners only to the top of the card.

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Image with ripple

To add a ripple effect you need to add ripple attributes to the <a> element wrapping the image (click on the image to see the effect).

Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Header and footer

You can also add optional header and footer sections to the card.

Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

2 days ago

Note: Cards have tons of available options. We won't cover it all in this lesson, because we have to finish our project. However, if you want to learn more about card have a look at cards documentation page.

Note 2: You can also try our Card generator.



John Doe

About author

Michal Szymanski

Co Founder at TW Elements and MDBootstrap / Listed in Forbes „30 under 30" / Open-source enthusiast / Dancer, nerd & book lover.

Author of hundreds of articles on programming, business, marketing and productivity. In the past, an educator working with troubled youth in orphanages and correctional facilities.