A dynamic solution for creating flexible content containers
In JTB_MD, Cards are dynamic content containers designed to enhance the presentation of information. These versatile components allow you to structure and style your content with flexibility, providing an engaging and organized user experience.
With customizable options and responsive designs, JTB_MD's Cards empower you to create visually appealing and well-organized content layouts for a variety of projects.
To create a card element in your project, start by adding a container with the .jtbCard
class. This container forms the core structure of the card. After creating the main container, enhance your card by adding a content area with the .jtbCard-content
class. This content area serves as the holder for all your card contents except the image of it.
<!-- Basic usage -->
<div class='jtbCard'>
<div class='jtbCard-content'>Hello there!</div>
</div>
By default, cards and content areas come as blank containers that has no meanings by theirselves. To create a fully functional card, after creating your main container with content area, utilize its main components: header, body and footer.
The Header is the top area of cards which states the title and other important stuff for it.
To incorporate a header area into your card, add an element with the .jtbCard-header
class within your content area.
<!-- Card with header only -->
<span class='jtbCard'>
<div class='jtbCard-content'>
<div class='jtbCard-header'>Header</div>
</div>
</span>
The Body is the main content area of cards that holds the information you want to display to your users.
To incorporate a body into your card, add an element with the .jtbCard-body
class within your content area.
<!-- Card with header & body -->
<span class='jtbCard'>
<div class='jtbCard-content'>
<div class='jtbCard-header'>...</div>
<div class='jtbCard-body'>
Card content<br>
Card content<br>
Card content<br>
</div>
</div>
</span>
The Footer is the content area of cards that holds additional information you want to display to your users such as action buttons.
To incorporate a footer into your card, add an element with the .jtbCard-footer
class within your content area.
<!-- Card with header & body & footer -->
<span class='jtbCard'>
<div class='jtbCard-content'>
<div class='jtbCard-header'>...</div>
<div class='jtbCard-body'>...</div>
<div class='jtbCard-footer'>Footer</div>
</div>
</span>
To create a card with an image in JTB_MD you can simply add three attributes to your .jtbCard
element:
imgSrc
the attribute that contains the source of your image.imgRatio
the attribute that contains the ratio of your image in width:height
format,imgPos
the attribute that contains the position of your image. Possible values are: start
, end
.
<!-- Card with image on start -->
<div class='jtbCard' imgSrc='...' imgRatio='12:9' imgPos='start'>
<div class='jtbCard-content'>
<div class='jtbCard-body'>...</div>
<div class='jtbCard-footer'>...</div>
</div>
</div>
<!-- Card with image on end -->
<div class='jtbCard' imgSrc='...' imgRatio='12:9' imgPos='end'>
<div class='jtbCard-content'>
<div class='jtbCard-body'>...</div>
<div class='jtbCard-footer'>...</div>
</div>
</div>>
You can also create horizontally oriented cards with image via adding .jtbCard-x
class into your .jtbCard
element.
<!-- Horizontal card with image on start -->
<div class='jtbCard jtbCard-x' imgSrc='...' imgRatio='12:9' imgPos='start'>
<div class='jtbCard-content'>
<div class='jtbCard-body'>...</div>
<div class='jtbCard-footer'>...</div>
</div>
</div>
<!-- Horizontal card with image on end -->
<div class='jtbCard jtbCard-x' imgSrc='...' imgRatio='12:9' imgPos='end'>
<div class='jtbCard-content'>
<div class='jtbCard-body'>...</div>
<div class='jtbCard-footer'>...</div>
</div>
</div>>
As you've learned how to create cards to display data, let's now explore how to enhance the visual appeal of your elements using pre-defined JTB_MD card classes.
If you want to remove all borders of your card, you can add .jtbCard-borderless
class into your .jtbCard
element.
<!-- Borderless card -->
<div class='jtbCard jtbCard-borderless'>
...
</div>
To create a rectangular card (with no border radius), apply the .jtbCard-rect
class to your card element.
<!-- Rectangular card -->
<div class='jtbCard jtbCard-rect'>
...
</div>
Copyright © 2024 JTBLabs - All rights reserved.