Bootstrap – Sizing ”; Previous Next This chapter discusses about Bootstrap sizing. Sizing allows you to adjust the height and width of an element through the utility classes. Relative to the parent The width and height utilities are created using the utility API found in _utilities.scss. They come with default support for values like 25%, 50%, 75%, 100%, and auto. You can customize these values to generate different utilities. Relative to the width The w-25, w-50, w-75, w-100, and w-auto classes define the width of each div element. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Sizing</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”w-25 p-3 text-bg-primary”>25% width</div> <div class=”w-50 p-3 text-bg-secondary”>50% width</div> <div class=”w-75 p-3 text-bg-warning”>75% width</div> <div class=”w-100 p-3 text-bg-info”>Full width (100%)</div> <div class=”w-auto p-3 text-bg-danger”>Auto width</div> </body> </html> Relative to the height The classes h-25, h-50, h-75, h-100, and h-auto are responsible for setting the height of each div element. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Sizing</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”text-bg-light” style=”height: 100px;”> <div class=”h-25 d-inline-block text-bg-primary text-center” style=”width: 150px;”>25% Height</div> <div class=”h-50 d-inline-block text-bg-secondary text-center” style=”width: 150px;”>50% Height</div> <div class=”h-75 d-inline-block bg-warning text-center” style=”width: 150px;”>75% Height</div> <div class=”h-100 d-inline-block text-bg-info text-center” style=”width: 150px;”>100% Height </div> <div class=”h-auto d-inline-block text-bg-danger text-center” style=”width: 150px;”>Auto Height</div> </div> </body> </html> Use class mw-100 to set the max-width: 100%. In the following example, we demonstrate the use of this class: Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Sizing</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”text-bg-light” style=”width: 50%; height: 100px;”> <div class=”mw-100 text-bg-warning text-center” style=”width: 200%;”>Maximum width 100%</div> </div> </body> </html> Use class mh-100 to set the max-height: 100%. In the following example, we demonstrate the use of this class: Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Sizing</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”text-bg-light” style=”height: 100px;”> <div class=”mh-100 text-bg-warning” style=”width: 100px; height: 200px;”>Maximum height 100%</div> </div> </body> </html> Relative to the viewport It is possible to modify the width and height of elements relative to the viewport. min-vw-100 – sets a minimum width of 100 viewport width. min-vh-100 – sets a minimum height of 100 viewport height. vw-100 – sets the width of the element to be exactly 100 viewport width. vh-100 – sets the height of the element to be exactly 100 viewport height. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Sizing</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container text-bg-light” > <div class=”min-vw-100 text-bg-primary p-3 my-2 d-inline-block”>Minimum width (min-vw-100)</div> <div class=”vw-100 text-bg-warning p-3 my-2 d-inline-block”>Width (vw-100)</div> <div class=”min-vh-100 text-bg-secondary p-3 mx-2 d-inline-block “>Minium height (min-vh-100)</div> <div class=”vh-100 text-bg-danger p-3 mx-2 d-inline-block”>Height (vh-100)</div> </div> </body> </html> Print Page Previous Next Advertisements ”;
Category: bootstrap
Bootstrap – Shadows
Bootstrap – Shadows ”; Previous Next This chapter discusses about the box-shadow utilities. Bootstrap provides a set of CSS classes that allows you to apply different types of box shadows to elements. The predefined classes available are as follows: Class Description .shadow-none No shadow effect. .shadow-sm Adds a small and subtle shadow effect. .shadow Applies a medium strength shadow effect. .shadow-lg Applies a large and prominent shadow effect. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Shadows</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container mt-3″> <h4>Shadow effect</h4> <div><button class=”btn shadow-none”>Button with no shadow</button></div> <div><button class=”btn shadow”>Button with a subtle shadow</button></div> <div><button class=”btn shadow-sm”>Button with a regular shadow</button></div> <div><button class=”btn shadow-lg”>Button with a larger shadow</button></div> </div> </body> </html> Print Page Previous Next Advertisements ”;
Bootstrap – Borders
Bootstrap – Borders ”; Previous Next This chapter discusses about the borders that can be applied to elements. Utilize border utilities to promptly apply styling to an element”s border and border-radius, making it suitable for images, buttons, or any other element. Borders can be either added or removed from an element. Bootstrap provides a range of border styles that can be chosen all at a time or one by one. Add a border Borders can be added to a custom element. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> <style> span { display: inline-block; width: 100px; height: 100px; margin: 10px; background-color: #f1f1f1 } </style> </head> <body> <div class=”container mt-3″> <h4>Borders</h4> <p>Use the border classes to add borders to an element:</p><br> <span class=”border border-2″></span> <span class=”border-top border-2″></span> <span class=”border-end border-2″></span> <span class=”border-bottom border-2″></span> <span class=”border-start border-2″></span> </div> </body> </html> Remove a border Borders can be removed from a custom element. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> <style> span { display: inline-block; width: 100px; height: 100px; margin: 10px; background-color: #f1f1f1; } </style> </head> <body> <div class=”container mt-3″> <h4>Borders</h4> <p>Use the border classes to remove borders from an element:</p><br> <span class=”border border-2″></span> <span class=”border border-0 border-2″></span> <span class=”border border-top-0 border-2″></span> <span class=”border border-end-0 border-2″></span> <span class=”border border-bottom-0 border-2″></span> <span class=”border border-start-0 border-2″></span> </div> </body> </html> Border colors The border utilities, such as .border-* generated from the original $theme-colors Sass map, currently do not adapt to color modes. However, any .border-*-subtle utility will respond accordingly. This issue will be addressed in version 6. The border color can be modified using the utilities built on theme colors. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> <style> span { display: inline-block; width: 100px; height: 100px; margin: 10px; background-color: #faf8f8; } </style> </head> <body> <div class=”container mt-3″> <h4>Borders color</h4><br> <p>Use the .border-* classes to add colors to the borders:</p><br> <span class=”border border-success”></span> <span class=”border border-success-subtle”></span> <span class=”border border-danger”></span> <span class=”border border-danger-subtle”></span> <span class=”border border-light”></span> <span class=”border border-light-subtle”></span> <span class=”border border-secondary”></span> <span class=”border border-secondary-subtle”></span> <span class=”border border-primary”></span> <span class=”border border-primary-subtle”></span> <span class=”border border-black”></span> <span class=”border border-white”></span> <span class=”border border-info”></span> <span class=”border border-info-subtle”></span> <span class=”border border-warning”></span> <span class=”border border-warning-subtle”></span> <span class=”border border-dark”></span> <span class=”border border-dark-subtle”></span> </div> </body> </html> The default border of an element can also be modified using the .border-* classes. Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container mt-3″> <h4>Border colors of elements</h4><br> <p>Use the .border-* classes to add colors to the borders of different elements:</p><br> <div class=”h4 pb-4 mb-2 text-center text-success border border-success”> Border for success </div> <div class=”p-2 bg-warning bg-opacity-25 border border-warning border-start-0″> Adding color to a warning text, with warning border. </div><br> <button class=”btn btn-light text-dark border”>Click</button> </div> </body> </html> Border opacity In order to change the opacity of the border, you need to override the –bs-border-opacity through the custom styles or inline styles. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container mt-3″> <h4>Border opacity of borders</h4><br> <p>Use the .border-* classes to change the opacity of the borders of different elements:</p><br> <div class=”border border-primary p-2 mb-2″>Primary border default</div> <div class=”border border-danger p-2 mb-2 border-opacity-75″>75% opacity of danger border</div> <div class=”border border-warning p-2 mb-2 border-opacity-50″>50% opacity of warning border</div> <div class=”border border-success p-2 mb-2 border-opacity-25″>25% opacity of success border</div> <div class=”border border-secondary p-2 border-opacity-10″>10% opacity of secondary border</div> </body> </html> Border width In order to change the width of the border of an element, use the classes such as .border-1, .border-2, .border-3, .border-4 and .border-5 Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> <style> span { display: inline-block; width: 100px; height: 100px; margin: 10px; background-color: #f9f6f6; } </style> </head> <body> <div class=”container mt-3″> <h4>Borders – width</h4><br> <p>Set the border width with .border-* classes:</p><br> <span class=”border border-5″></span> <span class=”border border-4″></span> <span class=”border border-3″></span> <span class=”border border-2″></span> <span class=”border border-1″></span> </div> </body> </html> Border radius In order to add rounded corners to any element, use the .rounded-* classes. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Borders</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> <style> span { display: inline-block; width: 100px; height: 100px; margin: 10px; background-color: #440d0d; } </style> </head> <body> <div class=”container mt-3″> <h4>Borders – Radius</h4> <p>Set the radius of the border with .rounded-* classes:</p><br> <span class=”rounded”></span> <span class=”rounded-top”></span> <span class=”rounded-bottom”></span> <span class=”rounded-start”></span> <span
Bootstrap – Focus Ring
Bootstrap – Focus ring ”; Previous Next This chapter discusses about adding and modifying custom focus ring styles to various elements and components. In Bootstrap 5, the focus ring is a visual indicator that appears around an element when it receives focus. The focus ring is a circular outline that appears around the element, typically in a contrasting color, to indicate that the element is currently active and ready to receive input from the user. Bootstrap 5 provides a built-in focus ring that is applied to interactive elements such as buttons, links, and form controls by default. The default outline on :focus is removed by the helper class .focus-ring, thus replacing it with a box-shadow. Let”s see an example showing the usage of .focus-ring: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container-fluid flex-grow-1″> <h4>Focus ring</h4> <a href=”#” class=”d-inline-flex focus-ring py-1 px-2 text-bg-light border rounded-2″> Example focus ring </a> <button class=”button focus-ring py-1 px-2 text-bg-light border rounded-2″>Click Me</button> </div> </body> </html> Customize focus ring Focus ring can be customized using the CSS variables, Sass variables, utilities, or custom styles. CSS variables In order to change the default appearance of a focus ring, modify the CSS variables –bs-focus-ring-* Let”s see an example of customizing the CSS variables –bs-focus-ring-*: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container-fluid flex-grow-1″> <h4>Focus ring – Customize CSS variable</h4> <a href=”#” class=”d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2″ style=”–bs-focus-ring-color: rgba(var(–bs-danger-rgb), .25)”> Red focus ring </a> <div> </body> </html> Let”s see an example of customizing the CSS variables –bs-focus-ring-* in order to make the focus ring blurry: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container-fluid flex-grow-1″> <h4>Focus ring – Customize CSS variable</h4> <a href=”#” class=”d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2″ style=”–bs-focus-ring-x: 20px; –bs-focus-ring-y: 20px; –bs-focus-ring-blur: 6px”> Blur focus ring </a> </div> </body> </html> Utilities Bootstrap provides several utilities .focus-ring-* to modify the default settings. For example, modify the color of the focus ring with any of the theme colors. Let”s see an example of customizing the utility .focus-ring-*: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <div class=”container-fluid flex-grow-1″> <h4>Focus ring – Customize utilities</h4> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-success py-1 px-2″>Success focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-info py-1 px-2″>Info focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-warning py-1 px-2″>Warning focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-danger py-1 px-2″>Danger focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-secondary py-1 px-2″>Secondary focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-primary py-1 px-2″>Primary focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-dark py-1 px-2″>Dark focus ring</a></p> <p><a href=”#” class=”d-inline-flex focus-ring focus-ring-light py-1 px-2″>Light focus ring</a></p> </div> </body> </html> Print Page Previous Next Advertisements ”;
Bootstrap-Sticky footer Demo
Bootstrap – Sticky Footer Demo ”; Previous Next What is a sticky footer? A sticky footer sticks to the bottom of the page, regardless of the page”s content length or viewport height. It ensures that the footer remains visible at the bottom of the browser window. The footer itself contains some text and copyright information. The provided link shows an example of sticky footer: Example Description Download link Sticky footer This example shows a web page with a sticky footer at the bottom of the viewport. Download Print Page Previous Next Advertisements ”;
Bootstrap – Sidebars Demo
Bootstrap – Sidebar Demo ”; Previous Next What is a sidebar? A sidebar is a vertical column placed alongside the main content area and used to display navigation information. Bootstrap sidebar represents a custom sidebar component built using Bootstrap”s classes and utilities. In Bootstrap, a sidebar is often created using a combination of the grid system, flexbox, and CSS classes such as .col and .d-flex. Some of the examples of the headers are as follows. Example Description Download link Dark sidebar menu structure This example shows a dark sidebar menu contains different sections and dropdown menu for user account Download Light sidebar menu structure This example shows a light sidebar with links to different sections and dropdown menu for user account. Download Sidebar with icons This example shows the sidebar menu which is represented by using icons. Download Collapsible sidebar This example shows a sidebar menu contains a list of links that collapsed to show or hide their respective submenus. Download sidebar with list Group This example shows sidebar menu represents a list group. Download Print Page Previous Next Advertisements ”;
Bootstrap – Sticky Footer Navbar Demo ”; Previous Next Sticky footer navbar A page can include a footer to the bootom of the viewport with a fixed top navbar. This can be useful for websites with long pages, as it allows users to quickly access navigation options, even when they scroll down to the bottom of the page. Bootstrap provides built-in CSS classes to create a sticky footer navbar. .navbar – This class is used to create the navigation bar at the top of the page. .footer – This class represents the sticky footer that will always appear at the bottom of the viewport. The provided link shows an example of sticky footer navbar: Example Description Download link Sticky footer navbar This example shows a fixed-top navigation bar and a sticky footer. Download Print Page Previous Next Advertisements ”;
Bootstrap – Clearfix
Bootstrap – Clearfix ”; Previous Next This chapter discusses the clearfix feature of helper classes. The clearfix feature in Bootstrap is used to clear floated elements within a container. When elements within a container are floated, the container”s height can sometimes be collapsed, causing issues with the layout. Here”s an example of how to use the .clearfix class in Bootstrap: Example The example below shows the usage of clearfix. Without the clearfix, the wrapping div would not span around the buttons which would cause a broken layout. You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Clearfix</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <h4>Clearfix example</h4><br> <div class=”bg-success clearfix”> <button type=”button” class=”btn btn-secondary float-start”>Button floated left</button> <button type=”button” class=”btn btn-secondary float-end”>Button floated right</button> </div> </body> </html> Print Page Previous Next Advertisements ”;
Bootstrap – Vertical Rule
Bootstrap – Vertical rule ”; Previous Next This chapter discusses about vertical rule. The custom vertical rule helper creates vertical dividers in common layouts, like the <hr> element. The vertical rule class is denoted as .vr It is 1px wide It has minimum-height of 1em Its color is set using currentColor and opacity You can customize the verical rules with additional styles as per your requirement. The example given below shows the usage of .vr class: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper – Vertical rule</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <link href=”https://getbootstrap.com/docs/5.3/assets/css/docs.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <h4>Vertical rule example</h4> <div class=”container”> <div class=”row”> <div class=”col-md-3 text-bg-light”> <p>Text on the left side of vertical divider.</p> </div> <div class=”col-md-1″> <hr class=”vr”> </div> <div class=”col-md-3 text-bg-light”> <p>Text on the right side of vertical divider.</p> </div> </div> </div> </body> </html> In flex layouts, the height of vertical rule adjusts automatically based on the size of its container. Let”s see an example where the height of vertical rule is based on the flex layout: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper – Vertical rule</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <link href=”https://getbootstrap.com/docs/5.3/assets/css/docs.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <h4>Vertical rule with flex</h4> <div class=”d-flex flex-row”> <div class=”flex-grow-1″> <p>Content on the left</p> </div> <div class=”d-flex flex-grow-1″ style=”height: 200px;”> <div class=”vr”></div> </div> <div class=”flex-grow-1″> <p>Content on the right</p> </div> </div> </body> </html> Vertical rule with stacks Vertical rule can also be used in stacks, to separate the different values. Let”s see an example where the vertical rule is used in stacks: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Helper – Vertical rule</title> <meta charset=”UTF-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <link href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css” rel=”stylesheet”> <link href=”https://getbootstrap.com/docs/5.3/assets/css/docs.css” rel=”stylesheet”> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js”></script> </head> <body> <h4>Vertical rule with stacks</h4> <div class=”hstack gap-1″> <div class=”p-3 text-bg-info”>First item</div> <div class=”vr”></div> <div class=”p-3 text-bg-primary”>Second item</div> <div class=”vr”></div> <div class=”p-3 text-bg-warning”>Third item</div> </div> </body> </html> Print Page Previous Next Advertisements ”;
Bootstrap – Slider Demo
Bootstrap – Slider Demo ”; Previous Next Bootstrap provides a few different options for styling Navigation slider. Some of examples are as shown below − Example Description Download link Slide menu on over This example indicates about Slider Menu structure in Bootstrap Download Sub Menu This example indicates about Slider Sub Menu structure in Bootstrap Download Sidebar With Tabs This example indicates about Slider With Tabs structure in Bootstrap Download Tabs This example indicates about Tabs structure in Bootstrap Download Print Page Previous Next Advertisements ”;