Vertical Alignment Classes


You can use the vertical alignment utility classes to quickly change the vertical alignment of inline, inline-block, inline-table, and table cell elements.

ClassDescriptionTest
.align-baselineAlign the baseline of the element with the baseline of its parent.Example
.align-topAlign the top of the element with the top of the entire line.Example
.align-middleAlign the element in the middle of the parent element.Example
.align-bottomAlign the bottom of the element with the bottom of the entire line.Example
.align-text-topAlign the top of the element with the top of the parent element’s font.Example
.align-text-bottomAlign the bottom of the element with the bottom of the parent element’s font.Example

Position Classes

You can use the position utility classes to quickly configuring the position of an element.

ClassDescriptionTest
.position-staticSet the position of element to static.Example
.position-relativeSet the position of element to relative.Example
.position-absoluteSet the position of element to absolute.Example
.position-fixedSet the position of element to fixed.Example
.position-stickySet the position of element to sticky.Example
.fixed-topPosition an element at the top of the viewport, from edge to edge.Example
.fixed-bottomPosition an element at the bottom of the viewport, from edge to edge.Example
.sticky-topPosition an element at the top of the viewport, from edge to edge, but that will only happen after you scroll past it.Example

Display Classes

You can use the display utility classes to quickly and responsively toggle the display value of an element. You can also control an element’s display when printing the page.

ClassDescriptionTest
.d-noneHide an element. It does not take up any space in the layout.Example
.d-inlineForce an element to generate an inline-level box.Example
.d-inline-blockForce an element to generate a block box that will be flowed with surrounding content i.e. in the same line as adjacent content like inline box.Example
.d-blockForce an element to generate a block-level box.Example
.d-tableForce an element to behave like a <table> element.Example
.d-table-rowForce an element to behave like a <tr> element.Example
.d-table-cellForce an element to behave like a <td> element.Example
.d-flexForce an element to generate a block-level flex container box.Example
.d-inline-flexForce an element to generate an inline-level flex container box.Example

You can also use the responsive breakpoints (smmdlgxl, and xxl.) with these display utility classes to show or hide elements depending on viewport width using the format .d-{breakpoint}-{value}, for example, .d-sm-none.d-md-block.d-lg-block.d-xl-block.d-xxl-block, and so on.

Tip: You can create print variant of the display classes to change the display value of elements when printing by simply inserting the string print- after .d-, for example, .d-print-none.d-print-inline.d-print-block.d-print-table, and so on.

Miscellaneous Classes

Here’s the list some more utility classes that can used for various purposes.

ClassDescriptionTest
.btn-closeCreate generic close icon for dismissing components like modals and alerts.Example
.overflow-autoProvide scrollbars to view overflowed content of an element if required.Example
.overflow-hiddenHide overflowed content of an element.Example
.overflow-visibleShow overflowed content of an element.Example
.overflow-scrollProvide scrollbars to view overflowed content of an element.Example
.stretched-linkMake an element clickable by stretching a nested link.Example
.visibleMake an element visible, without modifying the display.Example
.invisibleMake an element invisible, but it still take up space in the page.Example
.visually-hiddenHide an element to all devices except screen readers.Example

Leave a Reply

Your email address will not be published. Required fields are marked *