Bootstrap 4 Components
Cards
A card in BootStrap 4 is a flexible and extensible content container. A card can contain headers and footers, background colors, images, pretty much anything.
Note: cards in BootStrap 4 replaces panels, wells, and thumbnails in older versions. But their functionality can be included by using modifier classes to a card.
Example. Let’s begin with a simple card.
To create a basic card, add .card and .card-body
classes to an element to create the outer card element. Add classes .card-title
to add the title of the card and .card-text
to add the text in the card.
Card Example
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante..
MoreNote: by default, .card-body
gives padding to the contents inside it which give a spacing between the content and the card border. However, this padding can be avoided by putting the content outside of the .card-body
so that it places itself flushed against the card border. For that, place the .card-body
inside another <div>
element and nest it inside the parent <div>
.
List Groups
You can create a list group within a card..list-group-flush
creates a list that fits flush against the card’s border.
- Milk
- Eggs
- Bread
Links
Add links to the cards using <a>
element and class .card-link
within it.
Header and Footer
You can add a header or footer inside a card by adding the classes .card-header
and .card-footer
into a <div>
element.
Card Title
Card with a header and a footer.
Images in Cards
Images can be added to the top or bottom of the cards using .card-img-top
or .card-img-bottom. You can also add text to the cards using .card-text
.

Some quick example text to build on the card title and make up the bulk of the card's content.
Image Cap
Cards include ‘image caps’ which are images at the top or bottom.

Sunset
a beautiful sunset with mesmerizing shades of blue and red.
Last updated 3 mins ago

Sunset
a beautiful sunset with mesmerizing shades of blue and red.
Last updated 3 mins ago
Image Overlay
You can use images as card background and have the text lay on top of the image. For this give include the text content inside the class .card-image-overlay
. Use .text-white
if need be depending on whether the image gives dark or light background to the card.

Navigation in cards
To include navigation in cards use bootstrap nav components.
Nav-pills
Add the .card-header-pills
to the <ul>
element.
Card Sizing
Cards by default take up the entire width unless specified otherwise. The size of the cards can be specified using utility classes or using our own custom CSS files.
Using grid markup
Cards can be arranged in different columns in a row using Bootstrap grid layout.
Text Alignment
To align the text within the cards, use .text-align
classes.
Background Color Variants
Cards have different contextual classes to add color to the background and border of the classes based on their context.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Note: use .text-white for darker background colors.
Card Border Color
If you do not need cards with the background colors filled inside, you can remove the background color with matching border. To do this, replace default modifier class with .border-*
classes.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Card Groups
We can create a group of different cards using card group.

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

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

Some quick example text to build on the card title and make up the bulk of the card's content.
Card Decks
If you need spacing between the cards in a group of cards, use .card-deck
instead.

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

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

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