Introduction
In this article, I am going to explain how to use the Bootstrap 4 Cards and Forms in your project. A card is a flexible container for displaying content in different ways. You can add many styling components to cards like padding, alignment, colors, headings and so on. A form is used to get user information, for the purpose of login or contact details. Bootstrap 4 allows you to create responsive forms in web application.
To use Bootstrap 4 in your project, you need to have the following downloaded or CDN scripts. It should be added in the <head> tag.
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" ></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" ></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" ></script>
Cards
- To create outer card container use .card and .card-body classes.
- Use .card-title to any heading elements and .card-text to any text elements within the card container.
- Use .card-header and .card-footer for creating header and footer inside the card.
- To allign an image used with in the cards use .card-img-top or .card-img-down class to <img> tag.
- Use .card-link class to <a> element to display link inside the card.
- Use utility classes to change the background and border color of the card.
Add the following code to create the responsive Card in your project.
- <div class="row padding">
- <div class="col-lg-4 col-xs-12" >
- <div class="cards w3-container " style="@include animation(bounceIn 2s);">
- <div class="card-imd-top" ><img src="res1.jpg" width="100%"></div>
- <div class="card-title "><h2>West-Coast Resort</h2></div>
- <p class="card-text" >Its Located in the valley of West Bengal Neae Orissa and the Most Special Think about it is its inner location along the valleys of the sunderbans which is known for the food and deserts</p>
- </div>
- </div>
- <div class="col-lg-4 col-xs-12">
- <div class="cards">
- <div class="card-imd-top" ><img src="res2.jpg" width="100%"></div>
- <div class="card-title"><h2>EastCoast Resort</h2></div>
- <p class="card-text">Its Located in the valley of West Bengal Neae Orissa and the Most Special Think about it is its inner location along the valleys of the sunderbans which is known for the food and deserts</p>
- </div> </div>
- <div class="col-lg-4 col-xs-12">
- <div class="cards">
- <div class="card-imd-top" ><img src="res3.jpg" width="100%"></div>
- <div class="card-title"><h2>SouthernCoast Resort</h2></div>
- <p class="card-text">Its Located in the valley of West Bengal Neae Orissa and the Most Special Think about it is its inner location along the valleys of the sunderbans which is known for the food and deserts</p>
- </div> </div>
Output of responsive Cards in Bootstrap 4





alexsandro francoPosted Sep 22, 2024, 12:19 AM
Hello Manaka, how are you?I have the following question: I'm using card in bootstrap with c# core 3. I use <form>/<form> with card and button, however the button doesn't execute. Can you help me?
Nick StonePosted Sep 18, 2019, 12:59 AM
How do you handle this server side in razor pages?