Bootstrap card provide us a lot of functionality that we can play around. We can also make them responsive and also of fixed size all depends on our need. So the code for the fixed size bootstrap card deck is given below. We have provided the code without using CSS properties so it looks much simpler and easier to understand.
In this article, we will use some Bootstrap classes to design responsive card.
Also you can look for the code for how to create a card and then use it according to your need. You can modify the pictures using img tag given inside the card class div.
Example 1:
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title> How to design Responsive card-deck with fixed width in Bootstrap ? </title> <!-- bootstrap linked--> <link rel="stylesheet" href= integrity= "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> </head> <body> <!-- Card design with bootstrap class mx-auto for making it centered in the div--> <div class="card mx-auto" style="width:18rem;"> <img class="card-img-top" src= alt="Card image cap"> <div class="card-body"> <h5 class="card-title"> GeeksforGeeks </h5> <p class="card-text"> Geeks for Geeks is the best place to improve your computer science knowledge. </p> <a href="#" class="btn btn-success"> Click me </a> </div> </div> <!--card end here--> integrity= "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"> </script> <script src= integrity= "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"> </script> <script src= integrity= "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"> </script> </body> </html> |
Output:

Example 2:
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title> How to design Responsive card-deck with fixed width in Bootstrap ? </title> <!-- bootstrap linked--> <link rel="stylesheet" href= integrity= "sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> </head> <body> <div class="container-fluid p-0 m-0 align-items-center justify-content-center d-flex" style="min-height: 100vh; background-color: #498433;"> <!-- Row for the card--> <div class="row w-100 p-0 w-0"> <!-- Column for card--> <div class="col-lg-4 mb-2"> <div class="card mx-auto" style="width:18rem;"> <img class="card-img-top" src= alt="Card image cap"> <div class="card-body"> <h5 class="card-title"> Geeks for Geeks </h5> <p class="card-text"> Geeks for Geeks is the best place to improve your computer science knowledge. </p> <a href="#" class="btn btn-success"> Click me </a> </div> </div> </div> <!-- Another column for card --> <div class="col-lg-4 mb-2"> <div class="card mx-auto" style="width:18rem;"> <img class="card-img-top" src= alt="Card image cap"> <div class="card-body"> <h5 class="card-title"> Geeks for Geeks </h5> <p class="card-text"> Geeks for Geeks is the best place to improve your computer science knowledge. </p> <a href="#" class="btn btn-success"> Click me </a> </div> </div> </div> <!-- Another column for card --> <div class="col-lg-4 mb-2"> <div class="card mx-auto" style="width:18rem;"> <img class="card-img-top" src= alt="Card image cap"> <div class="card-body"> <h5 class="card-title"> Geeks for Geeks </h5> <p class="card-text"> Geeks for Geeks is the best place to improve your computer science knowledge. </p> <a href="#" class="btn btn-success"> Click me </a> </div> </div> </div> </div> </div> integrity= "sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"> </script> <script src= integrity= "sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"> </script> <script src= integrity= "sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"> </script> </body> </html> |
Output:

Note: Example 1 represents how to make a single card while example 2 represents how to embed that card efficiently such that it is responsive.
Recommended Posts:
- How to create responsive website zoomed out to full width on mobile using Bootstrap?
- How to design full width dropdown Navbar using Bootstrap ?
- Responsive images in Bootstrap with Examples
- How to set fixed width for <td> in a table ?
- How to make the existing bootstrap 2 table responsive?
- Bootstrap (Part-5) | DropDowns and Responsive Tabs
- How to create Responsive Bottom Navigation Bar using Bootstrap ?
- Responsive Video or Slideshow Embeds in Bootstrap with Examples
- How to create responsive image gallery using HTML, CSS, jQuery and Bootstrap?
- HTML | Viewport meta tag for Responsive Web Design
- How to configure modal width in Bootstrap?
- How to change the width and height of Twitter Bootstrap's tooltips?
- How Specify Length and Width of Square Grid Picture System in Bootstrap?
- How to fixed one column and scrollable other column or columns in Bootstrap ?
- How to Design Half-Page Carousel in Bootstrap ?
- HTML width/height Attribute vs CSS width/height Property
- Include Bootstrap in AngularJS using ng-bootstrap
- Difference between bootstrap.css and bootstrap-theme.css
- How to hide elements in responsive layout using CSS ?
- Best way to make a d3.js visualization layout responsive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


