Bootstrap 5 Tutorial
In Bootstrap 5, a card is a box with a border and padding around the contents. It has settings for content, colors, headers, footers, and other things.
The .card class is used to generate a basic card, while the .card-body class is used for content inside the card:
Basic card
Bootstrap 3 users may recognize that cards take the place of previous panels, wells, and thumbnails.
The card’s header and footer are added using the .card-header and .card-footer classes, respectively:
Header
Content
Footer
Use contextual classes (.bg-primary, .bg-success,.bg-info, .bg-warning, .bg-danger, .bg-secondary, .bg-dark, and.bg-light) to add a background color to the card.
Â
Â
Â
Â
Â
Â
Â
Â
To add card titles to any heading element, use the .card-title suffix. If a <p> element is the only or last child inside .card-body, its bottom margins are removed using the .card-text class. Any link can have a hover effect and a blue color added by using the .card-link class.
To position an image at the top or bottom inside the card, add .card-img-top or .card-img-bottom to a <img>. Observe that in order to fill the complete width, we have added the image outside of the .card-body:
To add text on top of an image that has been turned into a card background, use the .card-img-overlay function:
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.