Bootstrap – Range

Bootstrap – Range ”; Previous Next This chapter will discuss about Bootstrap form range. Range is an interactive component. The user can quickly scroll and slide through possible values spread across the required range. Basic example Use class .form-range to create unique controls for <input type=”range”>. Both track and thumb have the same appearance across all browsers. Bootstrap doesn”t support “filling” their range”s track from left to right of the thumb as a means to visually indicate progress. This is only supported on firefox. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Form – Range</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> <label for=”basicRange” class=”form-label”>Range</label> <input type=”range” class=”form-range” id=”basicRange”> </body> </html> Disabled The disabled attribute is used to disable the Range. Disabled range cannot be focused, appears greyed out, and has no pointer events. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Form – Range</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> <label for=”disabledRange” class=”form-label”>Range</label> <input type=”range” class=”form-range” id=”disabledRange” disabled> </body> </html> Min and max Default range input for min is 0 and max is 100. If you are using min and max attributes, new values can be specified. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Form – Range</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> <label for=”minmaxrange” class=”form-label”>Range</label> <input type=”range” class=”form-range” min=”0″ max=”9″ id=”minmaxrange”> </body> </html> Steps Range step determines how much the range input value will increase or decrease in one step. Number of steps is doubled when step=”0.5″ is used. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Form – Range</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> <label for=”stepRange” class=”form-label”>Range</label> <input type=”range” class=”form-range” min=”0″ max=”7″ step=”0.5″ id=”stepRange”> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Object Fit

Bootstrap – Object fit ”; Previous Next This chapter discusses about the object fit utilities. These utility classes are used to resize the content of the replaced elements, such as <img> or <video> to fit its container. The object-fit property either preserves the aspect ratio or stretches to take up as much as space available of the content in the container. The format of this property is .object-fit-{value}. Following are the values that .object-fit class takes up: contain – The entire content will be scaled down or up to fit within the container, while maintaining its original aspect ratio. cover – The content will be scaled to cover the entire container, potentially cropping parts of it. The aspect ratio will be maintained. fill – This is the default value. The image or video will fill the entire container, possibly stretching or squishing its original aspect ratio. scale (for scale down) – The content will be scaled down to fit within the container, but only if it would be scaled up by using the contain value. Otherwise, it behaves as none. none – This does not bring any change in the display of the content. Let us see an example for .object-fit: none: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Object fit</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> img { width:200px; height:400px; } </style> </head> <body> <div class=”container mt-3″> <h4>Object fit value – none</h4> <img src=”/bootstrap/images/tutimg.png” width=”667″ height=”184″ class=”object-fit-none”> </div> </body> </html> Let us see an example for another value object-fit: contain: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Object fit</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> img { width:200px; height:400px; } </style> </head> <body> <div class=”container mt-3″> <h4>Object fit value – contain</h4> <img src=”/bootstrap/images/tutimg.png” width=”667″ height=”184″ class=”object-fit-contain”> </div> </body> </html> Responsive The utility class .object-fit includes responsive variations for various breakpoints, such as sm, md, lg, xl, xxl, using the format .object-fit-{breakpoint}-{value}. Let us see an example for breakpoint (md): Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Object fit</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> img { width:200px; height:400px; } </style> </head> <body> <div class=”container mt-3″> <h4>Object fit value (contain) – breakpoint (md)</h4> <img src=”/bootstrap/images/tutimg.png” width=”667″ height=”184″ class=”object-fit-md-contain”> </div> </body> </html> Let us see an example for breakpoint (xxl): Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Object fit</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> img { width:200px; height:400px; } </style> </head> <body> <div class=”container mt-3″> <h4>Object fit value (fill) – breakpoint (xxl)</h4> <img src=”/bootstrap/images/tutimg.png” width=”667″ height=”184″ class=”object-fit-xxl-fill”> </div> </body> </html> Video The .object-fit utility classes also work on <video> elements. 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 – Object fit</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> video { border: 5px groove darkblue; padding: 30px; width: auto; height: auto; } </style> </head> <body> <div class=”container mt-3″> <h4>Object fit value (cover) – video</h4> <video src=”/bootstrap/images/foo.mp4″ class=”object-fit-cover” autoplay> </video> </div> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Visually Hidden

Bootstrap – Visually hidden ”; Previous Next This chapter discusses about classes provided by Bootstrap to visually hide any element, such as .visually-hidden and .visually-hidden-focusable. The .visually-hidden class in Bootstrap 5 is used to visually hide an element while keeping it accessible to screen readers and other assistive technologies. The .visually-hidden-focusable class is used to visually hide an element by default, but to display it when it’s focused, for example, on using a keyboard. The .visually-hidden-focusable class can also be used within a container :focus-within. The container will be displayed when any child element of the container receives focus. Test focusability: Use keyboard navigation to test the focusability of elements. Press the Tab key to navigate through the focusable elements and Shift + Tab to move backward. Let”s see an example on the usage of the classes .visually-hidden and .visually-hidden-focusable: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Visually hidden</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>Visually hidden</h4><br><br> <h4 class=”visually-hidden”>Hidden title for screen readers</h4> <a class=”visually-hidden-focusable” href=”#content”>Skip to home page</a> <div class=”visually-hidden-focusable”>A container with an <a href=”#”>element that is focusable</a>.</div> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Layout

Bootstrap – Form Layout ”; Previous Next This chapter will discuss about Bootstrap form layout. Add structure to your forms with form layout options, from inline to horizontal to implementing custom grids. Form layout Bootstrap gives no default styling for the <form> element, but there are a few capable browser highlights that are given by default. Each group of form fields must be inside a <form> element. Ensure to be specify and include a type attribute for <button>s within a <form> as they default to type=”submit”. Forms are stacked vertically by default. Bootstrap uses display: block and width: 100% to nearly all form controls. To change layout of each form, use additional classes. Utilities To add some structure to forms should be use margin utilities. Use basic grouping of labels, controls, optional form text, and form validation messages. For consistency, sticking to margin-bottom utilities and employing a single direction all through the form is recommended. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Layout </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=”mb-3″> <label for=”formGroupExampleInput” class=”form-label”>Username</label> <input type=”text” class=”form-control” id=”formGroupExampleInput” placeholder=”Username”> </div> <div class=”mb-3″> <label for=”formGroupExampleInput2″ class=”form-label”>Password</label> <input type=”text” class=”form-control” id=”formGroupExampleInput2″ placeholder=”password”> </div> </body> </html> Form grid Use grid classes for building the more complex forms. Form a grid for form layouts that require multiple columns, varied widths, and additional alignment options. You need to enable Sass variable using $enable-grid-classes. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Layout</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=”row mt-2″> <div class=”col”> <input type=”text” class=”form-control” placeholder=”Username” aria-label=”Username”> </div> <div class=”col”> <input type=”text” class=”form-control” placeholder=”Password” aria-label=”Password”> </div> </div> </body> </html> Gutters To control over the gutter width in the inline as block direction use the gutter modifier classes. By using $enable-grid-classes you can enable Sass variable. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Layout</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=”row g-3 mt-2″> <div class=”col”> <input type=”text” class=”form-control” placeholder=”Username” aria-label=”Username”> </div> <div class=”col”> <input type=”text” class=”form-control” placeholder=”Password” aria-label=”Password”> </div> </div> </body> </html> Create more complex layouts using the grid system. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Layout</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> <form class=”row g-3″> <div class=”col-md-6″> <label for=”inputFirst” class=”form-label”>First name</label> <input type=”text” class=”form-control” id=”inputFirst”> </div> <div class=”col-md-6″> <label for=”inputLast” class=”form-label”>Last name</label> <input type=”text” class=”form-control” id=”inputLast”> </div> <div class=”col-md-6″> <label for=”inputEmail” class=”form-label”>Email</label> <input type=”email” class=”form-control” id=”inputEmail”> </div> <div class=”col-6″> <label for=”inputPassword” class=”form-label”>Password</label> <input type=”Password” class=”form-control” id=”inputPassword” placeholder=”password”> </div> <div class=”col-12″> <label for=”inputAddress” class=”form-label”>Address</label> <input type=”text” class=”form-control” id=”inputAddress” placeholder=”Address”> </div> <div class=”col-md-6″> <label for=”inputAdharno” class=”form-label”>Adharcard no</label> <input type=”text” class=”form-control” id=”inputAdharno”> </div> <div class=”col-md-6″> <label for=”inputMobno” class=”form-label”>Mobile no</label> <input type=”text” class=”form-control” id=”inputMobno”> </div> <div class=”col-12″> <div class=”form-check”> <input class=”form-check-input” type=”checkbox” id=”gridCheck”> <label class=”form-check-label” for=”gridCheck”> I agree to terms and conditions </label> </div> </div> <div class=”col-12″> <button type=”submit” class=”btn btn-primary”>Submit</button> </div> </form> </body> </html> Horizontal form Use the class .row to form groups to create horizontal forms with the grid. Use the class .col-*-* to define the width of the labels and controls. To make a form vertically centered with their associated form controls, use the class .col-form-label to <label>. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Layout</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> <form> <div class=”row mb-3″> <label for=”inputEmail3″ class=”col-sm-2 col-form-label”>Email</label> <div class=”col-sm-10″> <input type=”email” class=”form-control” id=”inputEmail3″> </div> </div> <div class=”row mb-3″> <label for=”inputPassword3″ class=”col-sm-2 col-form-label”>Password</label> <div class=”col-sm-10″> <input type=”password” class=”form-control” id=”inputPassword3″> </div> </div> <fieldset class=”row mb-3″> <legend class=”col-form-label col-sm-2 pt-0″>Language Known</legend> <div class=”col-sm-10″> <div class=”form-check”> <input class=”form-check-input” type=”checkbox” name=”gridCheck” id=”gridCheck1″ value=”option1″ checked> <label class=”form-check-label” for=”gridCheck1″> English </label> </div> <div class=”form-check”> <input class=”form-check-input” type=”checkbox” name=”gridCheck” id=”gridCheck2″ value=”option2″> <label class=”form-check-label” for=”gridCheck2″> Hindi </label> </div> <div class=”form-check”> <input class=”form-check-input” type=”checkbox” name=”gridCheck” id=”gridCheck2″ value=”option2″> <label class=”form-check-label” for=”gridCheck2″> marathi </label> </div> <div class=”form-check disabled”> <input class=”form-check-input”type=”checkbox” name=”gridCheck” id=”gridCheck3″ value=”option3″ disabled> <label class=”form-check-label” for=”gridCheck3″> Others </label> </div> </div> </fieldset> <div class=”row mb-3″> <div class=”col-sm-10 offset-sm-2″> <div class=”form-check”> <input class=”form-check-input” type=”radio” id=”gridRadio1″> <label class=”form-check-label” for=”gridRadio1″> Radio Button </label> </div> </div> </div> <button type=”submit” class=”btn btn-primary”>Submit</button> </form> </body> </html> Horizontal form label sizing Use the classes .col-form-label-sm or .col-form-label-lg to your <label> or <legend> to follow the size of .form-control-sm and .form-control-lg respectively. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Layout</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=”row mb-3″> <label for=”colFormSm” class=”col-sm-2 col-form-label col-form-label-sm”>Username</label> <div class=”col-sm-10″> <input type=”email” class=”form-control form-control-sm” id=”colFormSm” placeholder=”Username”> </div> </div> <div class=”row mb-3″> <label for=”colFormLabel” class=”col-sm-2 col-form-label”>Password</label> <div class=”col-sm-10″> <input type=”text” class=”form-control” id=”colFormLabel” placeholder=”Password”> </div> </div> <div class=”row”> <label for=”colFormLg” class=”col-sm-2 col-form-label col-form-label-lg”>Email</label> <div class=”col-sm-10″> <input type=”email” class=”form-control form-control-lg” id=”colFormLg” placeholder=”email”> </div> </div> </body> </html> Column sizing As mentioned in the previous example, the grid system allows any number of

Bootstrap-Product Demo

Bootstrap – Product Demo ”; Previous Next Bootstrap provides product-focused marketing page with a lot of grid and image work, which are in the following example. Example Description Download link Product This example indicates about product in Bootstrap Download Print Page Previous Next Advertisements ”;

Bootstrap – Flex

Bootstrap – Flex ”; Previous Next This chapter discusses about the flex utilities. The .flex utility classes are helpful in quickly managing the layout, alignment and sizing of grid columns, navigation, components and much more. Enable flex behaviors Utilize display utilities to establish a flexbox container and convert immediate child elements into flex items, allowing for further customization of flex containers and items through additional flex properties. Let us see an example for a flex container and an inline flex container: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Flex</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>Flex utilities</h4> <div class=”d-flex p-4 bg-info”>A simple flexbox container!</div> <div class=”d-inline-flex p-4 bg-warning”>An inline flexbox container!</div> </body> </html> Variations that adapt to different screen sizes are also available for the classes .d-flex and .d-inline-flex. .d-flex .d-inline-flex .d-sm-flex .d-sm-inline-flex .d-md-flex .d-md-inline-flex .d-lg-flex .d-lg-inline-flex .d-xl-flex .d-xl-inline-flex .d-xxl-flex .d-xxl-inline-flex Direction Using the direction utilities, you can set the direction of flex items in a flex container. Following are the direction utilities provided by Bootstrap: .flex-row – to set a horizontal direction, which is also the browser default. .flex-row-reverse – to start the horizontal direction from the opposite side. .flex-column – to set a vertical direction. .flex-column-reverse – to start the vertical direction from the opposite side. Let us see an example for the direction utility classes: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Flex</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>Flex utilities – direction (row & column)</h4> <div class=”d-flex flex-row mb-4 bg-info border border-dark”> <div class=”p-3 border border-dark”>Row One</div> <div class=”p-3 border border-dark”>Row Two</div> <div class=”p-3 border border-dark”>Row Three</div> </div> <div class=”d-flex flex-row-reverse bg-warning border border-success”> <div class=”p-3 border border-success”>Row Four</div> <div class=”p-3 border border-success”>Row Five</div> <div class=”p-3 border border-success”>Row Six</div> </div> <div class=”d-flex flex-column mb-3 bg-danger-subtle bg-gradient border border-dark”> <div class=”p-3 border border-dark”>Column One</div> <div class=”p-3 border border-dark”>Column Two</div> <div class=”p-3 border border-dark”>Column Three</div> </div> <div class=”d-flex flex-column-reverse bg-light border border-dark”> <div class=”p-3 border border-dark”>Column Four</div> <div class=”p-3 border border-dark”>Column Five</div> <div class=”p-3 border border-dark”>Column Six</div> </div> </body> </html> Variations that adapt to different screen sizes are also available for the class .flex-direction: .flex-row .flex-row-reverse .flex-column .flex-column-reverse .flex-sm-row .flex-sm-row-reverse .flex-sm-column .flex-sm-column-reverse .flex-md-row .flex-md-row-reverse .flex-md-column .flex-md-column-reverse .flex-lg-row .flex-lg-row-reverse .flex-lg-column .flex-lg-column-reverse .flex-xl-row .flex-xl-row-reverse .flex-xl-column .flex-xl-column-reverse .flex-xxl-row .flex-xxl-row-reverse .flex-xxl-column .flex-xxl-column-reverse Justify content The .justify-content utility classes are used to change the alignment of flex items on the main axis, i.e. x -axis to start, and y-axis in case of flex-direction: column. The different options available are: start end center between around evenly Let us see an example for the justify content classes: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Flex</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>Flex utilities – Justify content</h4> <div class=”d-flex justify-content-start mb-4 bg-info border border-dark”> <div class=”p-3 border border-dark”>Row One</div> <div class=”p-3 border border-dark”>Row Two</div> <div class=”p-3 border border-dark”>Row Three</div> </div> <div class=”d-flex justify-content-end mb-4 bg-warning border border-success”> <div class=”p-3 border border-success”>Row Four</div> <div class=”p-3 border border-success”>Row Five</div> <div class=”p-3 border border-success”>Row Six</div> </div> <div class=”d-flex justify-content-center mb-4 bg-danger-subtle bg-gradient border border-dark”> <div class=”p-3 border border-dark”>Column One</div> <div class=”p-3 border border-dark”>Column Two</div> <div class=”p-3 border border-dark”>Column Three</div> </div> <div class=”d-flex justify-content-between mb-4 bg-light border border-dark”> <div class=”p-3 border border-dark”>Column Four</div> <div class=”p-3 border border-dark”>Column Five</div> <div class=”p-3 border border-dark”>Column Six</div> </div> <div class=”d-flex justify-content-around mb-4 bg-success-subtle bg-gradient border border-dark”> <div class=”p-3 border border-dark”>Column Four</div> <div class=”p-3 border border-dark”>Column Five</div> <div class=”p-3 border border-dark”>Column Six</div> </div> <div class=”d-flex justify-content-evenly mb-4 bg-primary-subtle bg-gradient border border-dark”> <div class=”p-3 border border-dark”>Column Four</div> <div class=”p-3 border border-dark”>Column Five</div> <div class=”p-3 border border-dark”>Column Six</div> </div> </div> </body> </html> Variations that adapt to different screen sizes are also available for the class .justify-content: .justify-content-start .justify-content-end .justify-content-center .justify-content-between .justify-content-around .justify-content-evenly .justify-content-sm-start .justify-content-sm-end .justify-content-sm-center .justify-content-sm-between .justify-content-sm-around .justify-content-sm-evenly .justify-content-md-start .justify-content-md-end .justify-content-md-center .justify-content-md-between .justify-content-md-around .justify-content-md-evenly .justify-content-lg-start .justify-content-lg-end .justify-content-lg-center .justify-content-lg-between .justify-content-lg-around .justify-content-lg-evenly .justify-content-xl-start .justify-content-xl-end .justify-content-xl-center .justify-content-xl-between .justify-content-xl-around .justify-content-xl-evenly .justify-content-xxl-start .justify-content-xxl-end .justify-content-xxl-center .justify-content-xxl-between .justify-content-xxl-around .justify-content-xxl-evenly Align items In order to change the alignment of flex items of a flexbox container, use the utility class align-items. The options available in Bootstrap are as follows: start end center baseline stretch (browser default) Let us see an example for the align items utility class: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Flex</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>Flex utilities – align items</h4> <div class=”d-flex align-items-start flex-row border bg-light mb-4″ style=”height:150px;”> <div class=”border border-dark p-2 text-bg-success”> Item 1 </div> <div class=”border border-dark p-2 text-bg-primary”> Item 2 </div> <div class=”border border-dark p-2 text-bg-danger”> Item 3 </div> </div> <div class=”d-flex

Bootstrap – Spinners

Bootstrap – Spinners ”; Previous Next This chapter will discuss about Bootstrap spinners. Bootstrap spinner display the loading state of projects using .spinner class. How it works Bootstrap spinners show the loading state of a project, using HTML and CSS. JavaScript is not required to build them. Custom JavaScript is needed to toggle their visibility. Appearance, alignment, and sizing can be easily customized with Bootstrap”s utility classes. Each loader has role=”status” and a nested <span class=”visually-hidden”>Loading… </span > for accessibility. Border spinner Use .spinner-border class to create lightweight spinner/loading indicator. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h3>Border Spinner</h3> <div class=”spinner-border mt-2″ role=”status”> <span class=”spinner-grow text-white spinner-grow-sm” role=”status”></span> <span class=”visually-hidden”></span> </div> </body> </html> Colors Border spinner uses currentColor for its border-color, which is customizable with text color utilities. Use text color utilities on a standard spinner. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h3>Colored Spinner</h3> <div class=”spinner-border text-primary” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-secondary” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-success” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-danger” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-warning” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-info” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-light” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-border text-dark” role=”status”> <span class=”visually-hidden”></span> </div> </body> </html> Why not use border-color utilities? Border spinners have transparent border on one side, overridden by .border-{color} utilities. Growing spinner You can change the spin type of spinner to the grow spinner. It technically doesn”t rotate, but it repeatedly grows. Use .spinner-grow class to create grow spinner. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h3>Growing Spinner</h3> <div class=”spinner-grow” role=”status”> <span class=”visually-hidden”></span> </div> </body> </html> This spinner uses currentColor to change its appearance with text color utilities. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h3>Growing color Spinners</h3> <div class=”spinner-grow text-primary” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-secondary” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-info” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-dark” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-warning” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-success” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-light” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow text-danger” role=”status”> <span class=”visually-hidden”></span> </div> <div class=”spinner-grow” role=”status”> <span class=”visually-hidden”></span> </div> </body> </html> Alignment Bootstrap spinners are designed with rems, currentColor, and display: inline-flex. They are easily resizable, recolorable, and alignable. Margin For simple spacing, use margin utilities like .m-4. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h3>Margin</h3> <div class=”spinner-border m-4″ role=”status”> <span class=”visually-hidden”></span> </div> </body> </html> Placement Bootstrap spinners can be placed using flexbox utilities, float utilities, or text alignment utilities. Flex Use flexbox placement classes to set the position of spinners. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h5 class=”text-center”>Flex placement at start, center, end</h5> <div class=”d-flex justify-content-start”> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> <div class=”d-flex justify-content-center”> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> <div class=”d-flex justify-content-end”> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> </body> </html> You can change spinner alignment using flexbox placement. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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=”d-flex align-items-end mt-2″> <h5 class=”text-center”>Flex placement</h5> <div class=”spinner-border ms-auto” role=”status” aria-hidden=”true”></div> </div> </body> </html> Float Use float placement classees to set the position of spinners. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h5>Float placement at start and end</h5> <div class=”clearfix float-start mt-2″> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> <div class=”clearfix float-end”> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> </body> </html> Text align Use .text-align placement classes to set the position of spinners items. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Spinners</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> <h5 class=”text-center”>Text Align at start, center, end</h5> <div class=”text-start”> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> <div class=”text-center”> <div class=”spinner-border” role=”status”> <span class=”visually-hidden”></span> </div> </div> <div class=”text-end”> <div class=”spinner-border” role=”status”>

Bootstrap – Floating Labels

Bootstrap – Floating Labels ”; Previous Next This chapter will discuss about Bootstrap floating labels. Floating labels refer to form labels that float over the input fields. Basic example To allow floating labels with Bootstrap”s textual form fields, include a pair of <input class=”form-control”> and <label> elements in .form-floating. Each <input> must have a placeholder since the technique for CSS-only floating labels employs the :placeholder-shown pseudo-element. The <input> needs to be placed first to make use of a sibling selector like (~). Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”form-floating mb-3 mt-2″> <input type=”text” class=”form-control” id=”floatingUsername” placeholder=”[email protected]”> <label for=”floatingUsername”>Username</label> </div> <div class=”form-floating”> <input type=”password” class=”form-control” id=”floatingPassword” placeholder=”Password”> <label for=”floatingPassword”>Password</label> </div> </body> </html> When a value is already assigned, <label> elements will automatically align their position to float over the input field. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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> <form class=”form-floating mt-2″> <input type=”email” class=”form-control” id=”floatingInputValue” placeholder=”[email protected]” value=”[email protected]”> <label for=”floatingInputValue”>Username</label> </form> </body> </html> By using form validation styles like is-invalid, you can provide visual feedback to users when they submit incorrect data. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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> <form class=”form-floating”> <input type=”text” class=”form-control is-invalid” id=”floatingInvalidInput” placeholder=”Password” value=”Password”> <label for=”floatingInvalidInput”>Invalid Password</label> </form> </body> </html> Textareas The height of <textarea> with the class .form-control is automatically set to have the same height as <input>. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”form-floating”> <textarea class=”form-control” placeholder=”Text Here” id=”floatingTextarea”></textarea> <label for=”floatingTextarea”>Text Here</label> </div> </body> </html> Don”t use the rows attribute if you want to customize the height of your <textarea>. Instead, specify a height explicitly (either inline or using customized CSS). In the below example we have used inline styling. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”form-floating”> <textarea class=”form-control” placeholder=”Add a comment” id=”floatingTextarea” style=”height: 100px”></textarea> <label for=”floatingTextarea”>Add a comment</label> </div> </body> </html> Selects Floating labels are only accessible on .form-selects, in addition to .form-control. The same concepts apply to them, except unlike <input>s, they always display the <label> in its floated state. Size-based and multiple selects are not supported. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”form-floating”> <select class=”form-select” id=”floatingSelect” aria-label=”Floating label select menu”> <option selected>Language</option> <option value=”1″>English</option> <option value=”2″>Hindi</option> <option value=”3″>Marathi</option> </select> <label for=”floatingSelect”>Others</label> </div> </body> </html> Disabled Add the disabled boolean attribute on an input. This gives grayed-out appearance to an input, textarea, or select. It also removes pointer events, and prevents focusing. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”form-floating mb-3″> <input type=”email” class=”form-control” id=”floatingInputDisabled” placeholder=”name” disabled> <label for=”floatingInputDisabled”>Name</label> </div> <div class=”form-floating mb-3″> <textarea class=”form-control” placeholder=”[email protected]” id=”floatingEmailDisabled” disabled></textarea> <label for=”floatingEmailDisabled”>Email Id</label> </div> <div class=”form-floating mb-3″> <textarea class=”form-control” placeholder=”Add a comment” id=”floatingTextareaDisabled” style=”height: 120px” disabled></textarea> <label for=”floatingTextareaDisabled”>Add a comment</label> </div> <div class=”form-floating”> <select class=”form-select” id=”floatingSelectDisabled” aria-label=”Floating label disabled select example” disabled> <option selected>Select Language</option> <option value=”1″>English</option> <option value=”2″>Hindi</option> <option value=”3″>Marathi</option> </select> <label for=”floatingSelectDisabled”>Others</label> </div> </body> </html> Readonly plaintext When switching from an editable <input> to a plaintext value without changing the page layout, .form-control-plaintext can be useful. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”form-floating mb-3 mt-2″> <input type=”text” readonly class=”form-control” id=”floatingEmptyPlaintextInput” style=”height: 80px” placeholder=”Block the comment” value=”Block the comment”> <label for=”floatingEmptyPlaintextInput”>Block the comment</label> </div> <div class=”form-floating mb-3″> <input type=”text” readonly class=”form-control” id=”floatingPlaintextInput” style=”height: 80px” placeholder=”Add a comment” value=”Add a comment”> <label for=”floatingPlaintextInput”>Add a comment</label> </div> </body> </html> Input groups Similarly, floating labels support .input-group. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Floating Labels</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=”input-group mb-3″> <div class=”form-floating”> <input type=”email” class=”form-control” id=”floatingInputGroup” placeholder=”email”> <label for=”floatingInputGroup”>Email Id</label> </div> <span class=”input-group-text”>[email protected]</span> </div> </body> </html> The -feedback (it is a validation class to provide valuable feedback to users before submitting the form.) should

Bootstrap – Ratio

Bootstrap – Ratio ”; Previous Next This chapter discusses about the aspect ratio. In Bootstrap, aspect ratio is used to maintain the proportions of a responsive element, such as an image or video, relative to its parent container. It is specified using the .ratio class along with a modifier class that represents the desired aspect ratio. To manage the aspect ratios of external content like <iframe>s, <embed>s, <video>s, and <object>s, use the ratio-* class. The ratio helper can also be used on standard HTML child element, such as a <div> or <img> The styles are applied from the parent .ratio class directly to the child element. The * in the aspect ratio modifier class can be replaceable with: ratio-21×9: creates a responsive element with a 21:9 aspect ratio ratio-16×9: creates a responsive element with a 16:9 aspect ratio ratio-4×3: creates a responsive element with a 4:3 aspect ratio ratio-1×1: creates a responsive element with a 1:1 aspect ratio Here”s an example of how aspect ratios are used with the <iframe> element. Here we are using the 16×9 aspect ratio: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Ratio</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> <h2 class=”text-success text-center”> Aspect Ratio 16×9 </h2> <hr> <div class=”ratio ratio-16×9″> <iframe src=”https://www.youtube.com/embed/4PWVFBiFVVU” title=”YouTube video” allowfullscreen> </iframe> </div> </body> </html> Here”s an example of how aspect ratios are used with the <iframe> element. Here we are using the 21×9 aspect ratio: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Ratio</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> <h2 class=”text-success text-center”> Aspect Ratio – 21×9 </h2> <hr> <div class=”ratio ratio-21×9″> <iframe src=”https://www.youtube.com/embed/4PWVFBiFVVU” title=”YouTube video” allowfullscreen> </iframe> </div> </body> </html> Custom Ratios In Bootstrap, a custom ratio allows you to define your own aspect ratio for a responsive element using a combination of CSS and JavaScript. This can be useful if you have a specific aspect ratio that is not covered by the built-in aspect ratio modifier classes. Following example demonstrates by setting –bs-aspect-ratio: 50% on the .ratio. Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Ratio</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> <h1 class=”text-success text-center”> Ratio </h1> <hr> <div class=”text-center”> <h2 class=”text-success”>Bootstrap 5 Custom ratios</h2> </div> <br> <div class=”ratio” style=”–bs-aspect-ratio: 10%;”> <div class=”bg-success”><h1>success</h1></div> </div> <div class=”ratio” style=”–bs-aspect-ratio: 30%;”> <div class=”bg-secondary”><h1>secondary</h1></div> </div> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Select

Bootstrap – Form Select ”; Previous Next This chapter will discuss about Bootstrap form select menu. Custom CSS can be used to alter the default appearance of the native <select> elements. Default Custom class .form-select is required for custom <select> menus, to trigger the custom styles. Due to browser restrictions, custom styles are only able to change the <select>”s default appearance and cannot change the <options>s. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Select Menu</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> <select class=”form-select” aria-label=”Default select example”> <option selected>Select Menu</option> <option value=”1″>Item 1</option> <option value=”2″>Item 2</option> <option value=”3″>Item 3</option> </select> </body> </html> Sizing In order to match the similar sized text inputs, you may also select from small and large custom selects. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Select Menu</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> <select class=”form-select form-select-lg mb-3″ aria-label=”.form-select-lg example”> <option selected>Large Sized Select Menu</option> <option value=”1″>Item 1</option> <option value=”2″>Item 2</option> <option value=”3″>Item 3</option> </select> <select class=”form-select form-select-sm” aria-label=”.form-select-sm example”> <option selected>Small Sized Select Menu</option> <option value=”1″>Item 1</option> <option value=”2″>Item 2</option> <option value=”3″>Item 3</option> </select> </body> </html> You can give multiple options in drop-down list using multiple attribute. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Select Menu</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> <select class=”form-select” multiple aria-label=”multiple select example”> <option selected>Select Menu</option> <option value=”1″>Item 1</option> <option value=”2″>Item 2</option> <option value=”3″>Item 3</option> </select> </body> </html> A size attribute restricts the number of options in a drop-down list. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Select Menu</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> <select class=”form-select” size=”4″ aria-label=”size 3 select example”> <option selected>Select Menu</option> <option value=”1″>Item 1</option> <option value=”2″>Item 2</option> <option value=”3″>Item 3</option> <option value=”3″>Item 4</option> </select> </html> Disabled In order to make a select appear greyed out and eliminate pointer events, add the disabled boolean attribute to it. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Form – Select Menu</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> <select class=”form-select” aria-label=”Disabled select example” disabled> <option selected>Select Menu</option> <option value=”1″>Item 1</option> <option value=”2″>Item 2</option> <option value=”3″>Item 3</option> </select> </html> Print Page Previous Next Advertisements ”;