Bootstrap – Colored Links

Bootstrap – Colored links ”; Previous Next This chapter discusses about the colored link feature of helper classes. The Bootstrap 5 colored links are used to add colors to the link elements. In order to make the links colored, use .link-* classes. These classes have :hover and :focus states, unlike the .text-* classes. In order to make the links legible, that have relatively light foreground color, use them on a dark background. .link-body-emphasis is the only colored link that is unique and high contrast link color. It comes with :hover and :focus styles. Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Colored link</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 p-2″> <h4>Colored links</h4><br> <p><a href=”#” class=”link-primary”>Primary Color Link</a></p> <p><a href=”#” class=”link-secondary”>Secondary Color Link</a></p> <p><a href=”#” class=”link-info”>Info Color Link</a></p> <p><a href=”#” class=”link-success”>Success Color Link</a></p> <p><a href=”#” class=”link-light bg-dark”>Light Color Link on dark background</a></p> <p><a href=”#” class=”link-dark”>Dark Color Link</a></p> <p><a href=”#” class=”link-warning”>Warning Color Link</a></p> <p><a href=”#” class=”link-danger”>Danger Color Link</a></p> <p><a href=”#” class=”link-body-emphasis”>Custom Emphasis Link</a></p> </div> </body> </html> Accessibility tip: Use of color just provides a visual indication, and this will not be helpful to users of assistive technologies like screen readers. Make sure that the meaning is clear from the content itself. Use alternative means to add clarity to the content using the .visually-hidden class. Link utilities Bootstrap provides a range of link utilities such as link opacity, link offset, underline color, underline opacity, and so on. Similarly colored links can also be modified using the link utilities. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Colored link</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 p-2″> <h4>Colored link utilities</h4><br> <p><a href=”#” class=”link-offset-1 link-primary link-opacity-50 link-underline-warning link-underline-opacity-75″>Primary Color Link</a></p> <p><a href=”#” class=”link-offset-1 link-secondary link-opacity-50 link-underline-danger link-underline-opacity-50″>Secondary Color Link</a></p> <p><a href=”#” class=”link-offset-2 link-info link-opacity-25 link-underline-success link-underline-opacity-100″>Info Color Link</a></p> <p><a href=”#” class=”link-offset-2 link-success link-opacity-75 link-underline-danger link-underline-opacity-70″>Success Color Link</a></p> </div> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Interactions

Bootstrap – Interactions ”; Previous Next This chapter discuss about Bootstrap utility classess that change the way users interact with contents of a website. Text selection This section demostrates how Bootstrap utility classess user-select-* change the way in which content is selected during user interactions. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Interactions</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> <p class=”user-select-all”>When the user clicks on this paragraph, the entire text will be selected.</p> <p class=”user-select-auto”>The select behavior of this paragraph is set to its default state.</p> <p class=”user-select-none”>When the user clicks on this paragraph, it will not be selectable.</p> </body> </html> Pointer events Bootstrap classes .pe-none and .pe-auto classes prevents and enabling of element interactions as demostrated in the following example. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Interactions</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> <p>Use the “pe-none” class to make the <a href=”#” class=”pe-none” tabindex=”-1″ aria-disabled=”true”>link</a> inactive.</p> <p>Use the “pe-auto” class to make the <a href=”#” class=”pe-auto”>link</a> active.</p> <p class=”pe-none”><a href=”#” tabindex=”-1″ aria-disabled=”true”>This link </a> is not active due to the inherited pointer-events property. Now, <a href=”#” class=”pe-auto”>This link</a> is an active.</p> </body> </html> The .pe-none class, along with the pointer-events CSS property it applies, is designed to disable interactions specifically with a pointer, such as a mouse, stylus, or touch input. By default, links, and controls with .pe-none remain functional and accessible for keyboard users. In order to achieve full neutralization for keyboard users, additional attributes can be included for keyboard users. These attributes may include tabindex=”-1″ to prevent keyboard focus, aria-disabled=”true” to indicate their disabled state to assistive technologies, and JavaScript could also be utilized to fully prevent any action on them. If possible, it can be done in a simpler way: For form controls: You can add the disabled attribute in the HTML. For links: Remove the “href” attribute from links, effectively making them non-interactive or placeholder elements. Print Page Previous Next Advertisements ”;

Bootstrap – Headers Demo

Bootstrap – Headers Demo ”; Previous Next What is a header? A header refers to the top section of a website, containing elements like the site”s logo, navigation menu, and other relevant information. The header is an essential part of a website”s layout. The <header> tag is an HTML element that defines a header section for the webpage. It is commonly placed at the top of the page. Some of the examples of the headers are as follows. Example Description Download link Simple header This example shows a simple header section with a logo and a title along with a navigation menu. Download Header at center This example shows a header section at center position. Download Header with buttons This example shows a header containing login and logout buttons on the right. Download Dark header This example shows dark header structure. Download Header with dropdown menu This example shows a header with a user dropdown menu on the right. Download Header with textbox This example shows header with dropdown menu and textbox. Download Double header This example shows a double header that includes a website logo, text, and search input field. Download Double header with icons This example shows a double header layout with icons. Download Print Page Previous Next Advertisements ”;

Bootstrap – Stacks

Bootstrap – Stacks ”; Previous Next This chapter discusses about stacks. A stack is an utility class that can be used to control the stacking of content within a container. The stack utility class controls the stacking order of elements. Stacks offer a quick and easy way of applying the flexbox properties to create layouts in Bootstrap. Vertical stack The class .vstack is used to create vertical layouts. The utilities such as .gap-* can be used to add space between items. By default, the stacked items are full-width. The example given below shows the usage of .vstack class: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Stack</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>Vertical stack example</h4><br> <div class=”vstack gap-1″> <div class=”text-bg-secondary p-2″>Item on First place</div> <div class=”text-bg-primary p-2″>Item on Second place</div> <div class=”text-bg-info p-2″>Item on Third place</div> </div> </body> </html> Stack the buttons or any other elements, using the class .vstack. Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Stack</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>Vertical stack using buttons</h4><br> <div class=”vstack gap-3 col-md-4 mx-auto”> <button type=”button” class=”btn btn-success”>Confirm changes</button> <button type=”button” class=”btn btn-secondary”>Cancel</button> </div> </body> </html> Horizontal stack The class .hstack is used to create horizontal layouts. The utilities such as .gap-* can be used to add space between items. By default, the stacked items are vertically centered and only take up their necessary width. The example given below shows the usage of .hstack class: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Stack</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>Horizontal stack example</h4><br> <div class=”hstack gap-3 column-gap-3″> <div class=”text-bg-warning p-2″>Item one</div> <div class=”text-bg-light p-2″>Item two</div> <div class=”text-bg-secondary p-2″>Item three</div> </div> </body> </html> The horizontal margin utility like .ms-auto can be used to add spaces. The utility class .ms-auto aligns the text to the right of the screen. Let”s see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Stack</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>Horizontal margin example</h4><br> <div class=”hstack gap-3 column-gap-3″> <div class=”text-bg-primary p-2″>Item one</div> <div class=”text-bg-secondary p-2″>Item two</div> <div class=”text-bg-info p-2 ms-auto”>Item three</div> </div> </body> </html> Vertical rules such as the class .vr is used to create a vertical divider. Let”s see an example for the same. 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 – Stack</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>Horizontal stack with vertical rule</h4><br> <div class=”hstack gap-3 column-gap-3″> <div class=”text-bg-secondary p-3″>Item one</div> <div class=”vr”></div> <div class=”text-bg-warning p-3″>Item two</div> <div class=”vr”></div> <div class=”text-bg-info p-3″>Item three</div> </div> </body> </html> An inline form can be created using the class .hstack. Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Helper – Stack</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>Create an inline form</h4><br> <div class=”hstack gap-2″> <input class=”form-control me-auto” type=”text” placeholder=”Add text here…” aria-label=”Add text here…”> <div class=”vr”></div> <button type=”button” class=”btn btn-success”>Submit</button> <div class=”vr”></div> <button type=”button” class=”btn btn-outline-danger”>Clear</button> </div> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Popovers

Bootstrap – Popovers ”; Previous Next This chapter will discuss about popovers in Bootstrap. A popover typically contains additional information, context, or actions related to the triggering element. The popover may contain text, images, links, buttons, or other content, depending on its purpose and context. Bootstrap provides built-in popover components that can be easily integrated into web applications. Things to remember while using the popover plug-in: As popovers depend on Popper.js, a third party library, for positioning, you must include popper.min.js before bootstrap.js. As a dependency, the popovers require the popover plugin. You must initialize the popovers first, as popovers are opt-in for performance reasons. A popover will never be shown for a zero-length title and content values. Triggering popovers will not work on hidden elements. Popovers for .disabled or disabled elements must be triggered using a wrapper element. To avoid getting popovers centered between the anchors” overall width, use white-space: nowrap; on the <a> Before removing any element from the DOM, you must hide the popovers corresponding to them. Enable Popovers Initialize all the popovers on a page, by their data-bs-toggle attribute const popoverTriggerList = document.querySelectorAll(”[data-bs-toggle=”popover”]”) const popoverList = […popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) Creating a Popover Add the data-bs-toggle=”popover” attribute to an element, to create a popover. The data-bs-toggle attribute defines the popover. The title attribute defines the title of the popover The data-content attribute defines the content to be shown in the respective popover. Example Let”s see an example of creating a popover: You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Popover</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>Bootstrap creation</h4><br><br> <button type=”button” class=”btn btn-primary” data-bs-toggle=”popover” data-bs-placement=”top” data-bs-title=”Popover” data-bs-content=”It is a new popover.”> Click to view popover </button> <script> const popoverTriggerList = document.querySelectorAll(”[data-bs-toggle=”popover”]”) const popoverList = […popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) </script> </body> </html> Positioning of a Popover There are four options available for the positioning of the popover: left, right, top and bottom aligned. By default, the popover will appear on the right of the element. The data-bs-placement attribute is used to set the position of the popover. Example Let”s see an example of setting the position of a popover: You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Popovers</title> <meta charset=”UTF-8″> <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>Positioning of Popover</h4> <br><br><br> <button type=”button” class=”btn btn-secondary” data-bs-container=”body” data-bs-toggle=”popover” data-bs-placement=”top” data-bs-content=”Top popover”> Popover on top </button> <button type=”button” class=”btn btn-secondary” data-bs-container=”body” data-bs-toggle=”popover” data-bs-placement=”right” data-bs-content=”Right popover”> Popover on right </button> <button type=”button” class=”btn btn-secondary” data-bs-container=”body” data-bs-toggle=”popover” data-bs-placement=”bottom” data-bs-content=”Bottom popover”> Popover on bottom </button> <button type=”button” class=”btn btn-secondary” data-bs-container=”body” data-bs-toggle=”popover” data-bs-placement=”left” data-bs-content=”Left popover”> Popover on left </button> <script> const popoverTriggerList = document.querySelectorAll(”[data-bs-toggle=”popover”]”) const popoverList = […popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) </script> </body> </html> Custom popovers The appearance of popovers can be customized using a custom class data-bs-custom-class=”custom-popover”. Example Let”s see an example of creating a custom popover: You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head&> <title>Bootstrap – Popovers</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>Custom Popover</h4><br><br> <!– Define custom container –> <button type=”button” class=”btn btn-primary” data-bs-toggle=”popover” data-bs-placement=”top” data-bs-custom-class=”custom-popover” data-bs-title=”Custom popover” data-bs-content=”It is a custom popover.”> Custom popover </button> <script> const popoverTriggerList = document.querySelectorAll(”[data-bs-toggle=”popover”]”) const popoverList = […popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) </script> </body> </html> Dismissible Popover The popover gets closed when the same element is clicked again, by default. However, the attribute data-bs-trigger=”focus” can be used, which will close the popover when clicking outside the element. For the popover to be dismissed on the next click, it is necessary to use specific HTML code that ensures consistent behavior across different browsers and platforms Example Let”s see an example of dismissible popover: You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Dismissible Popover</title> <meta charset=”UTF-8″> <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>Dismissed on next click – Popover</h4><br> <a href=”#” title=”Dismissible popover” data-bs-toggle=”popover” data-bs-trigger=”focus” data-bs-content=”Click anywhere in the document to close this popover”>Click me</a> </div> <script> const popoverTriggerList = document.querySelectorAll(”[data-bs-toggle=”popover”]”) const popoverList = […popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) </script> </body> </html> Hovering of a Popover When the mouse pointer is moved over an element and you want a popover to appear on hovering, use the data-bs-trigger=”hover” attribute. Example Let”s see an example of a hovering popover: You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Popover on hover</title> <meta charset=”UTF-8″> <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>Hoverable Popover</h4><br> <a href=”#” title=”Header” data-bs-toggle=”popover” data-bs-trigger=”hover” data-bs-content=”Popover text”>Hover over me</a> </div> <script> const popoverTriggerList = document.querySelectorAll(”[data-bs-toggle=”popover”]”) const popoverList = […popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl)) </script> </body> </html> Popover on disabled elements For popovers on disabled elements, you may prefer data-bs-trigger=”hover focus” so that the popover appears as immediate visual feedback to your users as they may not expect to click on a disabled element. Example Let”s see an example of a popover on disabled element: You can edit and try running this code using the Edit & Run option.

Bootstrap – Icon Link

Bootstrap – Icon link ”; Previous Next This chapter discusses about icon links, through which you can stylize the hyperlinks and other icons. In Bootstrap, an icon link is a link that is accompanied by an icon. The icon can be positioned either before or after the link text, and it is typically used to provide additional context or visual cues to the user. Icon links can be useful for adding visual interest and interactivity to your website or application, and they can be used in a variety of contexts such as navigation menus, buttons, or calls to action. The default link styles are modified by the icon link helper classes. They automatically align any pairing of icon and text and thus enhance their appearance on the page. Bootstrap icons along with any icon or image can be used in the icon links. Icons that are added only with the purpose of decoration, should be hidden from assistive technologies using aria-hidden=”true”. Icons that are added with purpose of conveying some meaning or information, provide an appropriate text alternative by adding role=”img” along with appropriate aria-label. Example To a regular <a> element, add .icon-link Insert an icon on either side of the link text. The .icon-link class will automatically size, place and color the icon. You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Icon Link</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> <link rel=”apple-touch-icon” href=”/docs/5.3/assets/img/favicons/apple-touch-icon.png” sizes=”180×180″> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon-32×32.png” sizes=”32×32″ type=”image/png”> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon-16×16.png” sizes=”16×16″ type=”image/png”> <link rel=”manifest” href=”/docs/5.3/assets/img/favicons/manifest.json”> <link rel=”mask-icon” href=”/docs/5.3/assets/img/favicons/safari-pinned-tab.svg” color=”#712cf9″> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon.ico”> <link rel=”canonical” href=”https://icons.getbootstrap.com/icons/search/”><script src=”/assets/js/color-modes.js”></script> <link rel=”stylesheet” href=”/assets/font/bootstrap-icons.min.css”><link rel=”stylesheet” href=”/assets/css/docs.css”> </head> <body> <nav class=”navbar navbar-inverse navbar-fixed-top text-bg-light” role=”navigation”> <div class=”container”> <div class=”navbar-header”> <h1 class=”logo”> <a title=”tutorialspoint”> <img alt=”tutorialspoint” src=”http://www.tutorialspoint.com/green/images/logo.png” style=”height: auto; width: auto; display: inline-block; top: 0px;”> </a> </h1> </div> </div> </nav> <div class=”container mt-2″> <svg xmlns=”http://www.w3.org/2000/svg” style=”display: none;”> <symbol id=”box-seam” viewBox=”0 0 16 16″> <path d=”M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2l-2.218-.887zm3.564 1.426L5.596 5 8 5.961 14.154 3.5l-2.404-.961zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z”></path> </symbol> </svg> <div class=”feature col”> <h3 class=”fs-2 text-danger”>Icon link example</h3> <p>Icon link feature of Bootstrap allows a user to add an icon along with an hyperlink and even the icon works as a link.</p> <a class=”icon-link” href=”#”> <svg class=”bi” aria-hidden=”true”> <use xlink:href=”#box-seam”></use></svg> Box Icon with text link </a> </div> </body> </html> Let us see another example where icon is placed after the text in an icon link: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Icon Link</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> <link rel=”apple-touch-icon” href=”/docs/5.3/assets/img/favicons/apple-touch-icon.png” sizes=”180×180″> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon-32×32.png” sizes=”32×32″ type=”image/png”> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon-16×16.png” sizes=”16×16″ type=”image/png”> <link rel=”manifest” href=”/docs/5.3/assets/img/favicons/manifest.json”> <link rel=”mask-icon” href=”/docs/5.3/assets/img/favicons/safari-pinned-tab.svg” color=”#712cf9″> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon.ico”> <link rel=”canonical” href=”https://icons.getbootstrap.com/icons/search/”><script src=”/assets/js/color-modes.js”></script> <link rel=”stylesheet” href=”/assets/font/bootstrap-icons.min.css”><link rel=”stylesheet” href=”/assets/css/docs.css”> </head> <body> <nav class=”navbar navbar-inverse navbar-fixed-top text-bg-light” role=”navigation”> <div class=”container”> <div class=”navbar-header”> <h1 class=”logo”> <a title=”tutorialspoint”> <img alt=”tutorialspoint” src=”http://www.tutorialspoint.com/green/images/logo.png” style=”height: auto; width: auto; display: inline-block; top: 0px;”> </a> </h1> </div> </div> </nav> <div class=”container mt-2″> <svg xmlns=”http://www.w3.org/2000/svg” style=”display: none;”> <symbol id=”airplane-fill” viewBox=”0 0 16 16″> <path d=”M6.428 1.151C6.708.591 7.213 0 8 0s1.292.592 1.572 1.151C9.861 1.73 10 2.431 10 3v3.691l5.17 2.585a1.5 1.5 0 0 1 .83 1.342V12a.5.5 0 0 1-.582.493l-5.507-.918-.375 2.253 1.318 1.318A.5.5 0 0 1 10.5 16h-5a.5.5 0 0 1-.354-.854l1.319-1.318-.376-2.253-5.507.918A.5.5 0 0 1 0 12v-1.382a1.5 1.5 0 0 1 .83-1.342L6 6.691V3c0-.568.14-1.271.428-1.849Z”></path> </symbol> </svg> <div class=”feature col”> <h3 class=”fs-2 text-success”>Icon link example</h3> <p>Icon link feature of Bootstrap allows a user to add an icon along with an hyperlink and even the icon works as a link. Here the icon is placed after the text in the icon link.</p> <a class=”icon-link” href=”#”>Icon after the text <svg class=”bi” aria-hidden=”true”> <use xlink:href=”#airplane-fill”></use> </svg> </a> </div> </body> </html> Style on hover In order to move the icon in an icon link to right, add the utility class .icon-link-hover to the class .icon-link. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Icon Link</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> <link rel=”apple-touch-icon” href=”/docs/5.3/assets/img/favicons/apple-touch-icon.png” sizes=”180×180″> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon-32×32.png” sizes=”32×32″ type=”image/png”> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon-16×16.png” sizes=”16×16″ type=”image/png”> <link rel=”manifest” href=”/docs/5.3/assets/img/favicons/manifest.json”> <link rel=”mask-icon” href=”/docs/5.3/assets/img/favicons/safari-pinned-tab.svg” color=”#712cf9″> <link rel=”icon” href=”/docs/5.3/assets/img/favicons/favicon.ico”> <link rel=”canonical” href=”https://icons.getbootstrap.com/icons/search/”><script src=”/assets/js/color-modes.js”></script> <link rel=”stylesheet” href=”/assets/font/bootstrap-icons.min.css”><link rel=”stylesheet” href=”/assets/css/docs.css”> </head> <body> <nav class=”navbar navbar-inverse navbar-fixed-top text-bg-light” role=”navigation”> <div class=”container”> <div class=”navbar-header”> <h1 class=”logo”> <a title=”tutorialspoint”> <img alt=”tutorialspoint” src=”http://www.tutorialspoint.com/green/images/logo.png” style=”height: auto; width: auto; display: inline-block; top: 0px;”> </a> </h1> </div> </div> </nav> <div class=”container mt-2″> <svg xmlns=”http://www.w3.org/2000/svg” style=”display: none;”> <symbol id=”chevron-right” viewBox=”0 0 16 16″> <path d=”M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z”></path> </symbol> </svg> </div> <div class=”feature col”> <h3 class=”fs-2 text-success”>Icon link example – hover</h3> <p>Icon link feature of Bootstrap allows a user to add an icon along with an hyperlink and even the icon works as a link. Here the icon moves to the right on hovering.</p> <a class=”icon-link icon-link-hover” href=”#”><strong>Icon link hover</strong> <svg class=”bi” aria-hidden=”true”> <use xlink:href=”#chevron-right”></use> </svg> </a> </div> </body> </html> Utilities In order to modify the underline color and offset of the icon link, use the custom link utilities provided by Bootstrap. To add color to the iconlink, use the class link-* (where * can be any color-modes like danger, success, warning, info, etc.)

Bootstrap – Close button

Bootstrap – Close Button ”; Previous Next This chapter will discuss about Bootstrap close button. Close button is used for dismissing content like modals, alerts, and popovers. Basic example Use .btn-close for creating a close button. Default styling is customizable. Change Sass variables to change background-image and add text for screen readers using aria-label. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Close Button</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-2″> Close Notification <button type=”button” class=”btn-close” aria-label=”Close”></button> </div> </body> </html> Disabled state Disable close buttons with disabled attribute. Bootstrap also applies pointer-events: none; and user-select: none; to prevent triggering of hover and active states. The opacity of disabled close buttons is changed. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Close Button</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-2″> Close Notification <button type=”button” class=”btn-close” disabled aria-label=”Close”></button> </div> </body> </html> Dark variant Take note! The .btn-close-white class is deprecated as of v5.3.0. Use data-bs-theme=”dark” for the close button color mode. To invert the close button, add data-bs-theme=”dark” to .btn-close class or to it”s parent elements. The filter property is used to invert the background-image. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Close Button</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> Close Notification <button type=”button” class=”btn-close” data-bs-theme=”dark” aria-label=”Close”></button> <button type=”button” class=”btn-close” data-bs-theme=”dark” disabled aria-label=”Close”></button> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Toasts

Bootstrap – Toasts ”; Previous Next This chapter discusses about the component toasts. Toasts are like alert messages, that are lightweight and customizable. Toasts are a useful tool for providing responsive and unobtrusive notifications to the user. Toasts in Bootstrap are used to display non-blocking notifications at the bottom or top of the screen. They can provide feedback or alert the user to certain events or actions, without interrupting their current task. Toasts can contain text, images, or any other HTML content, and can be customized to fit the design of the website or application. They can also be dismissed by the user or have a set duration before disappearing on their own. You must initialize the toasts yourself, as they are opt-in for performance reasons. If you do not specify autohide: false, toasts will automatically hide. The animation effect of the toast component is dependent on the prefers-reduced-motion media query. A header and a body is recommended to be added to a toast to make it more extensible and predictable. You require a single element to contain your toast and must have a dismiss button. Basic toast In order to create a basic toast, you need to use the .toast class and add a .toast-header to provide a heading and a .toast-body to add the content. Let us see an example of a basic toast: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap Example</title> <meta charset=”utf-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <link rel=”stylesheet” href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css”> <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”> <h3>Toast Example</h3> <p>A toast is like an alert box that is shown.</p> <div class=”toast fade show” role=”alert” aria-live=”assertive” aria-atomic=”true”> <div class=”toast-header”> <small>A toast without an event</small> <button type=”button” class=”btn-close” data-bs-dismiss=”toast” aria-label=”Close”></button> </div> <div class=”toast-body”> Toast is shown without any event like on a click of a button. </div> </div> </div> </body> </html> In the past, the .hide class was added automatically to completely hide a toast with display:none instead of using opacity:0. Now, this is no longer needed. The following JavaScript query is used to trigger a toast: const toastTrigger = document.getElementById(”liveToastBtn”) const toastLiveExample = document.getElementById(”liveToast”) if (toastTrigger) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) toastTrigger.addEventListener(”click”, () => { toastBootstrap.show() }) } OR $(document).ready(function() { $(”#liveToast”).click(function() { $(”.toast”).toast({ animation: false, delay: 3000 }); $(”.toast”).toast(”show”); }); }); Add the following link in your html: <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js”></script> Live toast Following is an example of a live toast that can be viewed on your page: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Toasts</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> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js”></script> </head> <body class=”container mx-auto mt-2″> <h4>View Live toast</h4> <button type=”button” class=”btn btn-success” id=”liveToast”>View toast live</button> <div class=”toast-container position-fixed bottom-0 end-0 p-4″> <div id=”liveToast” class=”toast” role=”alert” aria-live=”assertive” aria-atomic=”true”> <div class=”toast-header”> <strong class=”me-auto”>Live Toast</strong> <small>Now</small> <button type=”button” class=”btn-close” data-bs-dismiss=”toast” aria-label=”Close”></button> </div> <div class=”toast-body”> This is a live toast and placed at the bottom of the page. </div> </div> </div> <script> $(document).ready(function() { $(”#liveToast”).click(function() { $(”.toast”).toast({ animation: false, delay: 3000 }); $(”.toast”).toast(”show”); }); }); </script> </body> </html> Translucent toast Toasts are somewhat translucent and blend with the page on which they appear. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Toasts</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> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js”></script> </head> <body class=” container mx-auto mt-2″> <h4>Translucent toast</h4> <button type=”button” class=”btn btn-success” id=”viewToast”>Click for toast</button> <div class=”toast-container position-top top-0″> <div id=”viewToast” class=”toast” role=”alert” aria-live=”assertive” aria-atomic=”true”> <div class=”toast-header”> <strong class=”me-auto”>Translucent Toast</strong> <small class=”text-body-secondary”>First toast</small> <button type=”button” class=”btn-close” data-bs-dismiss=”toast” aria-label=”Close”></button> </div> <div class=”toast-body”> This is a translucent toast and placed at the top of the page. </div> </div> </div> <script> $(document).ready(function() { $(”#viewToast”).click(function() { $(”.toast”).toast({ animation: false, delay: 3000 }); $(”.toast”).toast(”show”); }); }); </script> </body> </html> Stacking of toasts Toasts can be stacked in a toast container by wrapping them. Vertical space is added to the toasts when stacked. Let us see an example: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <title>Bootstrap – Toasts</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> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js”></script> </head> <body class=” container mx-auto mt-2″> <h4>Stacking of toasts</h4> <button type=”button” class=”btn btn-success” id=”viewToast”>View stacked toasts</button> <!– First Toast –> <div class=”toast-container position-top top-0″> <div id=”viewToast” class=”toast” role=”alert” aria-live=”assertive” aria-atomic=”true”> <div class=”toast-header”> <strong class=”me-auto”>Toast 1</strong> <small class=”text-body-secondary”>First toast</small> <button type=”button” class=”btn-close” data-bs-dismiss=”toast” aria-label=”Close”></button> </div> <div class=”toast-body text-bg-warning”> This is toast 1 and is placed at the top of the page. </div> </div> <!– Second Toast –> <div id=”viewToast” class=”toast” role=”alert” aria-live=”assertive” aria-atomic=”true”> <div class=”toast-header”> <strong class=”me-auto”>Toast 2</strong> <small class=”text-body-secondary”>Second toast</small> <button type=”button” class=”btn-close” data-bs-dismiss=”toast” aria-label=”Close”></button> </div> <div class=”toast-body text-bg-info”> This is toast 2 and is placed below toast 1. </div> </div> </div> <script> $(document).ready(function() { $(”#viewToast”).click(function() { $(”.toast”).toast({ animation: false, delay: 3000 }); $(”.toast”).toast(”show”); }); }); </script> </body> </html> Custom content The toasts can be customized by removing the sub-components, adding some utilities or even for that matter, your own markup. You can add a custom icon from Bootstrap icons or remove the .toast-header, add buttons to the content, etc. Let us see an example for the customization of a toast, where two buttons are added to the toast body: Example

Bootstrap – Vertical Align

Bootstrap – Vertical align ”; Previous Next This chapter discusses about the vertical alignment utilities provided by Bootstrap. You can change the vertical alignment of inline, inline-block, inline-table, and table cell elements. Choose from following classes as per your need: .align-baseline .align-top .align-middle .align-bottom .align-text-bottom .align-text-top In order to align the non-inline content, use flex box utilities Let us see an example to align the inline elements: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Vertical align</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 class=”display-5″>Vertical align</h4> <p>Change the alignment of elements with the align classes (only works on inline, inline-block, inline-table and table cell elements):</p><br><br> <button class=”btn align-baseline text-bg-success”>align baseline</button> <button class=”btn align-top text-bg-success”>align top</button> <button class=”btn align-middle text-bg-success”>align middle</button> <button class=”btn align-bottom text-bg-success”>align bottom</button> <button class=”btn align-text-top text-bg-success”>align text top</button> <button class=”btn align-text-bottom text-bg-success”>align text bottom </button> </div> </body> </html> Let us see an example to align the table cell elements: Example You can edit and try running this code using the Edit & Run option. <!DOCTYPE html> <html> <head> <title>Bootstrap – Vertical align</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 class=”display-5″>Vertical Align – Table cell elements</h4> <p>Change the alignment of elements with the align classes (only works on inline, inline-block, inline-table and table cell elements):</p><br><br> <table class=”table-bordered bg-light” style=”height: 100px;”> <tbody> <tr> <td class=”p-2 align-baseline”>align baseline</td> <td class=”p-2 align-top”>align top</td> <td class=”p-2 align-middle”>align middle</td> <td class=”p-2 align-bottom”>align bottom</td> <td class=”p-2 align-text-top”>align-text-top</td> <td class=”p-2 align-text-bottom”>align-text-bottom</td> </tr> </tbody> </table> </div> </body> </html> Print Page Previous Next Advertisements ”;

Bootstrap – Buttons

Bootstrap – Buttons ”; Previous Next This chapter will discuss about Bootstrap Buttons.You can use Bootstrap’s custom button styles for actions in forms, dialogs and many more. This support for multiple sizes, states,…etc. Bootstrap includes the class .btn that sets basic styles such as padding and content alignment. Base button Add .btn class that implements basic styles such as padding and content alignment. The .btn class provides a transparent border, a background color, and no explicit focus and hover styles. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <button type=”button” class=”btn btn-primary”>Base Button </button> </body> </html> Variants Bootstrap includes different styles of buttons, each serving its own semantic purpose, with some extras thrown in for further control. To achieve the button styles, Bootstrap provides following classes: .btn .btn-default .btn-primary .btn-success .btn-info .btn-warning .btn-danger .btn-link Example You can edit and try running this code using Edit & Run option. <DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <button type=”button” class=”btn btn-primary”>Primary</button> <button type=”button” class=”btn btn-secondary”>Secondary</button> <button type=”button” class=”btn btn-success”>Success</button> <button type=”button” class=”btn btn-danger”>Danger</button> <button type=”button” class=”btn btn-warning”>Warning</button> <button type=”button” class=”btn btn-info”>Info</button> <button type=”button” class=”btn btn-light”>Light</button> <button type=”button” class=”btn btn-dark”>Dark</button> <button type=”button” class=”btn btn-link”>Link</button> </body> </html> Disabled text wrapping To disable the text wrapping on a button text, add .text-nowrap class to the button. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <button type=”button” class=”btn btn-primary text-nowrap”>this button”s text has disabled text wrapping. Here we see the test in a single line</button><br><br><br> <button type=”button” class=”btn btn-primary”>this button”s text does not have text wrapping enabled. Here we see the text being wrapped to next line</button> </body> </html> Button tags The .btn classes can be used on <a> and <input> elements. When you are using button classes on <a> elements that used to trigger in-page functionality instead of linking to new pages or sections within the current page these links have element role=”button” to appropriately convey their purpose to assistive technologies such as screen readers. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <a href=”#”role=”button” class=”btn btn-info”>Download Link</a> <button type=”button” class=”btn btn-primary”>Button</button> <input type=”submit” class=”btn btn-secondary” value=”Submit”> <input type=”button” class=”btn btn-danger” value=”Login”> <input type=”reset” class=”btn btn-light” value=”Reset”> </body> </html> Outline button To get the button without heavy background colors, use .btn-outline-* class which allows you to remove all background images and colors from any button. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <button type=”button” class=”btn btn-outline-primary”>Primary Button</button> <button type=”submit” class=”btn btn-outline-secondary”>Secondary Button</button> <button type=”button” class=”btn btn-outline-warning”>Warning Button</button> <button type=”button” class=”btn btn-outline-success”>Sucess Button</button> <button type=”button” class=”btn btn-outline-light”>Light Button</button> <button type=”button” class=”btn btn-outline-danger”>Danger Button</button> <button type=”button” class=”btn btn-outline-dark”>Dark Button</button> <button type=”button” class=”btn btn-outline-info”>Info Button</button> <button type=”button” class=”btn btn-outline-link”>Link</button> </button> </body> </html> Button sizes To get any larger or smaller buttons add the classes .btn-lg, .btn-sm to the .btn. You can create your own custom size button by using CSS variables. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <button type=”button” class=”btn btn-primary btn-lg”>Large button</button> <button type=”button” class=”btn btn-info btn-sm”>Small Button</button> <button type=”button” class=”btn btn-warning” style=”–bs-btn-padding-y: .24rem; –bs-btn-padding-x: .8rem; –bs-btn-font-size: .75rem;”> Custom Button </button> </body> </html> Disabled state Bootstrap provides class .disabled. This feature disables from hovering and active states of click event. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <button type=”button” class=”btn btn-primary disabled”>Primary Disabled Button</button> <button type=”button” class=”btn btn-secondary” disabled>Secondary Disabled Button</button> <button type=”button” class=”btn btn-outline-primary” disabled>Outline Primary Disabled button</button> <button type=”button” class=”btn btn-outline-secondary” disabled>Outline Secondary Disabled Button</button> </button> </body> </html> Disabled buttons using the <a> element that has slightly different behavior: The element <a> doesn”t support the disabled attribute. You have to add the .disabled class to make it visually seem disabled. To disable all pointer-events on anchor buttons, some future-friendly styles are included. To show the state of the element to assistive technologies in disabled buttons using <a> should contain aria-disabled=”true” attribute. The href attribute should not be included within disabled buttons using <a>. Example You can edit and try running this code using Edit & Run option. <!DOCTYPE html> <html lang=”en”> <head> <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> <title>Bootstrap – Buttons</title> </head> <body> <a class=”btn btn-primary disabled” role=”button” aria-disabled=”true”>Primary Disabled</a>