Javascript MDBootstrap Cards Component
Last Updated :
07 Mar, 2022
MDBootstrap is a Material Design and bootstrap-based Javascript UI library that is used to make attractive webpages with its seamless and easy-to-use component. It is free for both personal & commercial use. In this article, we will know how to use Cards Component in Javascript MDBootstap.
A Cards Component is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. It replaces the use of panels, wells, and thumbnails. All of it can be used in a single container called a card.
Syntax:
<div class="card">
<img src="link"/>
<divclass="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Text</p>
<button class="btn">Button</button>
</div>
</div>
Approach:
- Download Javascript MDBootstrap from the official site.
- Extract the files to the current working directory.
- In the Index.html file, specify the downloaded file path in the <head> tag.
<link rel=”icon” href=”img/mdb-favicon.ico” type=”image/x-icon” />
<link rel=”stylesheet” href=”https://use.fontawesome.com/releases/v5.15.2/css/all.css” />
<link rel=”stylesheet” href=”https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap”/>
<link rel=”stylesheet” href=”css/mdb.min.css” />
<script type=”text/javascript” src=”js/mdb.min.js”></script>
<script type=”text/javascript”></script>
Example 1: This is the basic example that shows how to use the cards component in MDBootstrap Javascript.
HTML
<!DOCTYPE html >
< html lang = "en" >
< head >
< title >Javascript MDBootstrap List Group Component</ title >
< meta charset = "UTF-8" />
< meta name = "viewport"
content=" width = device -width,
initial-scale = 1 ,
shrink-to-fit = no " />
< link rel = "icon"
href = "img/mdb-favicon.ico"
type = "image/x-icon" />
< link rel = "stylesheet"
href =
< link rel = "stylesheet"
href =
< link rel = "stylesheet"
href = "css/mdb.min.css" />
< script type = "text/javascript"
src = "js/mdb.min.js" >
</ script >
</ head >
< body >
< div style = "margin-left: 50px;" >
< h2 style = "margin-top: 50px;" >
GeeksforGeeks
</ h2 >
< h4 >
MDBootstrap Javascript Cards Component
</ h4 >
< br >
< div class = "card"
style = "width: 600px" >
< img style="width: 200px;
height: 200px;"
src =
< div style = "width: 500px"
class = "card-body" >
< h5 class = "card-title" >Card title</ h5 >
< p class = "card-text" >
MDBootstrap is a Material Design
and bootstrap-based Javascript UI
library that is used to make good
looking webpages with its seamless
and easy-to-use component.
</ p >
< button class = "btn btn-warning" >Button</ button >
</ div >
</ div >
</ div >
</ body >
</ html >
|
Output:
Javascript MDBootstrap Cards Component
Example 2: In this example, we will know how to add a header and footer in a Card Component in MDBootstrap Javascript.
HTML
<!DOCTYPE html >
< html lang = "en" >
< head >
< title >Javascript MDBootstrap List Group Component</ title >
< meta charset = "UTF-8" />
< meta name = "viewport"
content=" width = device -width,
initial-scale = 1 ,
shrink-to-fit = no " />
< link rel = "icon"
href = "img/mdb-favicon.ico"
type = "image/x-icon" />
< link rel = "stylesheet"
href =
< link rel = "stylesheet"
href =
< link rel = "stylesheet"
href = "css/mdb.min.css" />
< script type = "text/javascript"
src = "js/mdb.min.js" >
</ script >
</ head >
< body >
< div style = "margin-left: 50px;" >
< h2 style = "margin-top: 50px;" >
GeeksforGeeks
</ h2 >
< h4 >
MDBootstrap Javascript Cards Component
</ h4 >
< br >
< div class = "card text-center"
style = "width: 600px" >
< h3 class = "card-header" >Header</ h3 >
< div class = "card-body" >
< h5 class = "card-title" >Card title</ h5 >
< p class = "card-text" >
MDBootstrap is a Material Design
and bootstrap-based Javascript UI
library that is used to make good
looking webpages with its seamless
and easy-to-use component.
</ p >
< div class = "card-footer" >Footer</ div >
</ div >
</ div >
</ div >
</ body >
</ html >
|
Output:
Javascript MDBootstrap Cards Component
Reference: https://mdbootstrap.com/docs/standard/components/cards
Share your thoughts in the comments
Please Login to comment...