- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Style Bootstrap 4 card with bg-primary class
Use the bg-primary class in Bootstrap 4, to add important stuff to a card and set blue background color.
Style the Bootstrap 4 card as in the following code snippet −
<div class="card bg-primary text-white"> <div class="card-body">Medical Books</div> </div>
I have set the body of the card in the card-body class −
<div class="card-body"> Medical Books </div>
To implement the bg-primary class in Bootstarp 4, you can try to run the following code −
Example
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Books</h2> <div class="card bg-info text-white"> <div class="card-body">History Books</div> </div><br> <div class="card bg-primary text-white"> <div class="card-body">Medical Books</div> </div><br> </div> </body> </html>
- Related Articles
- Style Bootstrap 4 card with bg-success class
- Style Bootstrap 4 card with bg-warning class
- Style Bootstrap card with bg-info class
- Bootstrap 4 card styled with bg-secondary class
- Style Bootstrap 4 cards with bg-danger class
- Style Bootstrap 4 cards with bg-dark class
- bg-light class for Bootstrap 4 cards
- Bootstrap 4 .border-primary class
- Bootstrap 4 .card-columns class
- Bootstrap 4 .card-group class
- Bootstrap 4 .card-text class
- Bootstrap 4 .card-header class
- Bootstrap 4 .card-link class
- Bootstrap 4 .card-footer class
- Bootstrap 4 .card-subtitle class

Advertisements