Content helpers
Besides basic typography classes, helper classes are an extra set of additional predefined classes, that can be applied to different content or layout elements and components. Helper classes are custom additions mostly, written especially for current layout, except common BS helpers. Below is a summarized table with all available classes, descriptions and content type. Flex utilities are moved to a separate page and include various examples.
Classes | Usage | Description |
---|---|---|
Borders | ||
.border-0 |
Any element | Use this class to remove all borders from an element |
.border-[side]-0 .border-[side]-[breakpoint]-0 |
Any element | Use this class to remove specific borders. Available [side] options: start , end , top , bottom . |
.border-width-0 |
Any element | Sets border width to 0. Useful for inheriting other border properties |
.border |
Any element | Adds a border to an element with pre-defined BS's default width and color properties |
.border-width-[size] |
Any element | Adds the border to an element. Available [size] options: 0, 1, 2, 3, 4, 5 |
.border-width-[side]-[size] |
Any element | Same as .border-[size] , but for specific [side]: start , end , top , bottom |
.border-[color] |
Any element | Changes color of all element's borders. Supports all available color classes, including transparent option |
.border-[side]-[color] |
Any element | If you need to change color of some specific border, use this class combination. Options for [side]: left , right , top , bottom |
.border-style-[dashed|dotted] |
Any element | Changes border style from solid to dashed or dotted. Dashed borders also support top/bottom/left/right options |
Border radius | ||
.rounded |
Any element | Rounds all borders. Default value is defined in $border-radius variable |
.rounded-[side] |
Any element | Rounds borders of specific [side]: top , bottom , left , right |
.rounded-[side]-[start|end] |
Any element | Rounds borders of 1 corner of specific vertical [side]: top , bottom |
.rounded-0 |
Any element | Removes rounded corners from all borders |
.rounded-[side]-0 |
Any element | Removes rounded corners from specific [side]: top , bottom , left , right |
.rounded-pill |
Any element | Adds 100rem border radius to all borders |
.rounded-[side]-pill |
Any element | Adds 100rem border radius to specific [side]: top , bottom , left , right |
.rounded-circle |
Any element | Adds 50% border radius to all borders |
Transformations | ||
.rotate-cw |
Any element | Rotates element clockwise. Options for [value]: 45 , 90 , 180 degrees |
.rotate-ccw |
Any element | Rotates element counterclockwise. Options for [value]: 45 , 90 , 180 degrees |
.spinner |
Any element | Adds infinite clockwise rotation |
.spinner-reverse |
Any element | Adds infinite counterclockwise rotation |
.translate-middle .translate-middle-[x|y|start|top] |
Any element | Centers element vertically and/or horizontally |
Positioning | ||
.position-[value] |
Any element | Changes element's positiion. Available options for [value]: relative , static , absolute , fixed , sticky |
.fixed-[top|bottom] |
Any element | Position an element at the top (bottom) of the viewport, from edge to edge |
.sticky-[top|bottom] |
Any element | Position an element at the top (bottom) of the viewport relatively to its parent |
.top-[0|50|100|auto] |
All except static | Resets top property for fixed, absolute and relative opsitions |
.bottom-[0|50|100|auto] |
All except static | Resets bottom property for fixed, absolute and relative opsitions |
.start-[0|50|100|auto] |
All except static | Resets left property for fixed, absolute and relative opsitions |
.end-[0|50|100|auto] |
All except static | Resets right property for fixed, absolute and relative opsitions |
Alignment | ||
.float-[side] |
Any element | Element floating. Options for [side]: start , end sides |
.float-[breakpoint]-[side] |
Any element | Responsive variations of element floating. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
.float-none |
Any element | Removes floating |
.clearfix |
Any element | Easily clear floats by adding .clearfix to the element |
.text-[side] |
Inline element, text | Element alignment. Options for [side]: left , center , right sides |
.text-[breakpoint]-[side] |
Inline element, text | Responsive variations of element alignment. Options for [breakpoint]: sm , md , lg , xl screen sizes |
.align-[value] |
Inline element, table | Vertical alignment. Options for [value]: baseline , top , middle , bottom , text-top and text-bottom |
Images | ||
.img-fluid |
Images only | Applies max-width: 100%; and height: auto; to the image so that it scales nicely to the parent element |
.img-thumbnail |
Images only | Adds grey frame with white background color |
Sizing | ||
.wmin-[value] |
Any element | Sets a minimum width of the element in pixels. Available options for [value]: 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 pixels |
.wmin-[breakpoint]-[value] |
Any element | Responsive variations of width utilities. Options for [breakpoint]: sm , md , lg , xl screen sizes |
.mw-[value] |
Any element | Sets a maximum width of the element in pixels. Available option for [value] is 100% |
.vw-[value] |
Any element | Sets viewport container width in vw . Available option for [value] is 100 |
.min-vw-[value] |
Any element | Sets viewport container min-width in vw . Available option for [value] is 100 |
.w-[responsive value] |
Any element | Sets a responsive width of the element in percents. Values are: [25, 50, 75, 100, auto]. Supports breakpoints |
.w-[fixed values] |
Any element | Sets a responsive width of the element in pixels. Values are: 16px, 24px, 32px, 40px, 48px, 56px, 64px, 72px, 80px |
.h-[responsive value] |
Any element | Sets a responsive height of the element in percents. Values are: [25, 50, 75, 100, auto]. Supports breakpoints |
.h-[fixed values] |
Any element | Sets a responsive height of the element in pixels. Values are: 16px, 24px, 32px, 40px, 48px, 56px, 64px, 72px, 80px |
.vh-[value] |
Any element | Sets viewport container height in vh . Available option for [value] is 100 |
.min-vh-[value] |
Any element | Sets viewport container min-height in vh . Available option for [value] is 100 |
Visibility | ||
.overflow-[value] |
Containers | Content overflow utility. Available options for [value]: hidden - hides content, visible - shows content, auto - makes content scrollable, scroll - always displays scrollbar |
.visible |
Containers | Makes the element invisible for the user, but visible for screen readers |
.invisible |
Containers | Can be used to toggle only the visibility of an element, meaning its display is not modified and the element can still affect the flow of the document |
Display | ||
.d-[value] |
Any element | Set of classes for display property. Values are: inline, inline-block, block, grid, table, table-row, table-cell, flex, inline-flex, none |
.d-[breakpoint]-[value] |
Any element | Responsive variations of d-[value] utility. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Spacing | ||
.m-[size] |
Any element | Adds margin property to all sides. Available [size] are: 0 , 1 ~ 5px, 2 ~ 10px, 3 ~ 20px, 4 ~ 30px, 5 ~ 40px, auto |
.m-[breakpoint]-[size] |
Any element | Responsive variations of .m-[size] utility. Options for [breakpoint]: sm , md , lg , xl screen sizes |
.m[s,e,t,b,x,y]-[size] |
Any element | Adds margin property to the specific side: s - left (start), e - right (end), t - top, b - bottom, x - horizontal, y - vertical. Options for the size are the same |
.m[s,e,t,b]-[breakpoint]-[size] |
Any element | Same as for .m-[breakpoint]-[size] , except x and y options |
.p-[size] |
Any element | Adds padding property to all sides. Available [size] are: 0 , 1 ~ 5px, 2 ~ 10px, 3 ~ 20px, 4 ~ 30px, 5 ~ 40px, auto |
.p-[breakpoint]-[size] |
Any element | Responsive variations of .p-[size] utility. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
.p[s,e,t,b,x,y]-[size] |
Any element | Adds padding property to the specific side: s - left (start), e - right (end), t - top, b - bottom, x - horizontal, y - vertical. Options for the size are the same |
.p[s,e,t,b]-[breakpoint]-[size] |
Any element | Same as for .p-[breakpoint]-[size] , except x and y options |
Text | ||
.font-[value] |
Text | Sets/overrides font family. Available [value] options: monospace , serif |
.fs-[value] |
Text | Sets/overrides font size. Available [value] options: base ~ 14px, xs ~ 12px; sm - 13px, lg ~ 15px |
.fw-[value] |
Text | Sets/overrides font weight. Available [value] options: light , lighter , normal , medium , semibold , bold , bolder |
.fst-[value] |
Text | Sets/overrides font style. Available [value] options: italic , normal |
.lh-[value] |
Text | Line height. Available [value] options: base , xs ; sm , lg and 1 |
.text-decoration-[value] |
Text | Text decoration. Available [value] options: none , underline , line-through |
.text-[value] |
Text | Various text styles. Available [value] options: lowercase , uppercase , capitalize , wrap , nowrap , break |
Color | ||
.text-[color] |
Text | Sets text color. Available [value] options: muted , white , dark , black , primary , secondary , danger , success , warning , info , pink , purple , indigo , teal , yellow |
.link-[color] |
Text | Sets text link color. Available [value] options: muted , white , dark , black , primary , secondary , danger , success , warning , info , pink , purple , indigo , teal , yellow |
.bg-[color] |
Block and inline elements | Sets background color. Available [value] options: muted , white , dark , black , primary , secondary , danger , success , warning , info , pink , purple , indigo , teal , yellow |
Opacity | ||
.opacity-[value] |
Any element | Changes opacity of an element. Available [value] options: 0, 25, 50, 75, 100 |
.border-opacity-[value] |
Any element | Changes border opacity. Supported values are: 0, 10, 15, 20, 25, 50, 75, 100 |
.text-opacity-[value] |
Any element | Changes text opacity. Supported values are: 0, 10, 15, 20, 25, 50, 75, 100 |
.bg-opacity-[value] |
Any element | Changes background color opacity. Supported values are: 0, 10, 15, 20, 25, 50, 75, 100 |
Shadow | ||
.shadow |
Any element | Adds box shadowto an element |
.shadow-[value] |
Any element | Adds or removes box shadow. Supported values are: none, sm, lg |
Misc | ||
.user-select-[value] |
Any element | Enable or disable selection. Available [value] options: all, auto, none |
.pe-[value] |
Any element | Changes pointer events. Available [value] options: none, auto |
.cursor-[value] |
Any element | Changes cursor style. Available [value] options: move , pointer and default styles |
.filter-none |
Any element | Removes all CSS filters |
.transition-none |
Any element | Removes all CSS transitions |
zindex |
jQuery plugins | Resets z-index of an element. Values are: 1, auto |
Flex utilities
Enable flex behaviors
Apply display
utilities to create a flexbox container and transform direct children elements into flex items. Flex containers and items are able to be modified further with additional flex properties. The .d-flex
class makes the flex container a block-level element. The .d-inline-flex
class makes the flex container an atomic inline-level element. Please note: an anonymous flex item that contains only white space is not rendered, as if it were designated display: none
. Also clear
and vertical-align
properties have no effect on flex items, and float
causes the display
property of the element to compute to block
.
Flexbox container
Inline flexbox container
Classes | Description |
---|---|
.d-flex |
Displays an element as a block-level flex container |
.d-[breakpoint]-flex |
Responsive variations of .d-flex class. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
.d-inline-flex |
Displays an element as an inline-level flex container |
.d-[breakpoint]-inline-flex |
Responsive variations of .d-inline-flex class. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Flex direction
Set the direction of flex items in a flex container with direction utilities. In most cases you can omit the horizontal class here as the browser default is row
. However, you may encounter situations where you needed to explicitly set this value (like responsive layouts). Use .flex-row
to set a horizontal direction (the browser default), or .flex-row-reverse
to start the horizontal direction from the opposite side. Use .flex-column
to set a vertical direction, or .flex-column-reverse
to start the vertical direction from the opposite side.
Row direction
Reverse row direction
Column direction
Reverse column direction
Justify content
Use justify-content
utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if flex-direction: column
). Choose from start
(browser default), end
, center
, between
, or around
values. The alignment is done after the lengths and auto margins are applied, meaning that, if in a Flexbox layout there is at least one flexible element, with flex-grow
different from 0
, it will have no effect as there won't be any available space.
Beginning (start) of the container
Center of the container
End of the container
With space between the lines
With space before, between, and after the lines
Classes | Description |
---|---|
.justify-content-[value] |
Aligns the flex container's items when the items don't use all available space on the main-axis (horizontally). Available options for [value]: start (browser default), end , center , between , or around . |
.justify-content-[breakpoint]-[value] |
Responsive variations of .justify-content-[value] classes. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Align items
Use align-items
utilities on flexbox containers to change the alignment of flex items on the cross axis (the y-axis to start, x-axis if flex-direction: column
). Choose from start
, end
, center
, baseline
, or stretch
(browser default). Basically it works like justify-content
, but in the perpendicular direction. Tip: use the align-self
property of each item to override the align-items
property.
Beginning (start) of the container
Center of the container
End of the container
WBaseline of the container
Fit the container
Classes | Description |
---|---|
.align-items-[value] |
Alignment of items inside flex container. Options for [value]: start , end , center , baseline , or stretch (browser default). |
.align-items-[breakpoint]-[value] |
Responsive variations of .align-items-[value] classes. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Align self
Use align-self
utilities on flexbox items to individually change their alignment on the cross axis (the y-axis to start, x-axis if flex-direction: column
). Choose from the same options as align-items: start
, end
, center
, baseline
, or stretch
(browser default). The property doesn't apply to block-level boxes, or to table cells.
Beginning (start) of the container
Center of the container
End of the container
Baseline of the container
Fit the container
Classes | Description |
---|---|
.align-self-[value] |
Alignment of the selected item inside flex container. Options for [value]: start , end , center , baseline , or stretch (browser default). |
.align-self-[breakpoint]-[value] |
Responsive variations of .align-self-[value] classes. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes. |
Flex fill
Use the .flex-fill
class on a series of sibling elements to force them into widths equal to their content (or equal widths if their content does not surpass their border-boxes) while taking up all available horizontal space.
Right auto margin
Classes | Description |
---|---|
.flex-fill |
All breakpoints |
.flex-[breakpoint]-fill |
Responsive variations of .flex-fill class. Options for [breakpoint]: sm , md , lg , xl screen sizes |
Flex stretch
Equivalent to flex: [positive-number]
1 0. Makes the flex item flexible and sets the flex basis to zero, resulting in an item that receives the specified proportion of the free space in the flex container. If all items in the flex container use this pattern, their sizes will be proportional to the specified flex factor. Other words it's similar to .flex-fill
, but forces elements to stretch equally regardless content length. To reset .flex-1
use .flex-0
class.
Example
Classes | Description |
---|---|
.flex-0 |
All breakpoints. Equivalent to flex: 0 1 0% |
.flex-[breakpoint]-0 |
Responsive variations of .flex-0 class. Options for [breakpoint]: sm , md , lg , xl screen sizes |
.flex-1 |
All breakpoints. Equivalent to flex: 1 1 0% |
.flex-[breakpoint]-1 |
Responsive variations of .flex-1 class. Options for [breakpoint]: sm , md , lg , xl screen sizes |
Grow and shrink
Grow
This property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). The remaining space is the size of the flex container minus the size of all flex items' sizes together. In the example below, the .flex-grow-1
elements uses all available space it can, while allowing the remaining two flex items their necessary space.
Example
Shrink
Use .flex-shrink-*
utilities to toggle a flex item’s ability to shrink if necessary. In the example below, the second flex item with .flex-shrink-1
is forced to wrap its contents to a new line, “shrinking” to allow more space for the previous flex item with .w-100
. If it's with .flex-shrink-0
class, text won't wrap.
Example
Classes | Description |
---|---|
.flex-[grow|shrink]-0 |
All breakpoints |
.flex-[grow|shrink]-1 |
All breakpoints |
.flex-[breakpoint]-[grow|shrink]-0 |
Responsive variations of .flex-grow-0 and .flex-shrink-0 classes to use in 4 breakpoints. |
.flex-[breakpoint]-[grow|shrink]-1 |
Responsive variations of .flex-grow-1 and .flex-shrink-1 classes to use in 4 breakpoints. |
Auto margins
Flexbox can do some pretty awesome things when you mix flex alignments with auto margins. Shown below are three examples of controlling flex items via auto margins: default (no auto margin), pushing two items to the right (.me-auto
), and pushing two items to the left (.ms-auto
). Unfortunately, IE10 and IE11 do not properly support auto margins on flex items whose parent has a non-default justify-content
value.
Right auto margin
Left auto margin
Bottom auto margin
Top auto margin
Classes | Description |
---|---|
.m[t,b,s,e]-auto |
Pushes flex items to specified side, where "s" is left, "e" is right, "t" is top and "b" is bottom. |
.m[t,b,s,e]-[breakpoint]-auto |
Responsive variations of .m[t,b,s,e]-auto classes. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Flex wrap
The flex-wrap
classes specify whether flex items are forced into a single line or can be wrapped onto multiple lines. If wrapping is allowed, this property also enables you to control the direction in which lines are stacked. Note: if the elements are not flexible items, the flex-wrap
property has no effect. Supports 2 directions: default and reversed.
No wrap
Wrap - default direction
Wrap - reversed direction
Classes | Description |
---|---|
.flex-nowrap |
The flex items are laid out in a single line - may cause the flex container to overflow |
.flex-[breakpoint]-nowrap |
Responsive variations of .flex-nowrap class. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
.flex-wrap |
The flex items break into multiple lines |
.flex-[breakpoint]-wrap |
Responsive variations of .flex-wrap class. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
.flex-wrap-reverse |
Behaves the same as .flex-wrap , but in reverse order |
.flex-[breakpoint]-wrap-reverse |
Responsive variations of .flex-wrap-reverse class. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Flex order
Change the visual order of specific flex items with a handful of order
utilities. We only provide options for making an item first or last, as well as a reset to use the DOM order. As order takes any integer value (e.g., 5), add custom CSS for any additional values needed. Elements with the same order value are laid out in the order in which they appear in the source code. Note: If the element is not a flexible item, the order property has no effect.
Default order
Custom order
Default order
Custom order
Classes | Description |
---|---|
.order-[value] |
Specify the order used to lay out flex items in their flex container. Values for [value]: 1 , 2 , ... 12 . |
.order-[breakpoint]-[value] |
Responsive variations of .order-[value] classes. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |
Align content
Use align-content
utilities on flexbox containers to align flex items together on the cross axis. Choose from start
(browser default), end
, center
, between
, around
, or stretch
. To demonstrate these utilities, we’ve enforced flex-wrap: wrap
and increased the number of flex items. Note: this property has no effect on single rows of flex items.
Start of the flex container
End of the flex container
Center of the flex container
Evenly in the flex container
Evenly with half-size spaces on either end
Stretch to take up the remaining space
Classes | Description |
---|---|
.align-content-[value] |
Similar to align-items, but instead of aligning flex items, it aligns flex lines. Options for [value] are similar to .justify-content-[value] classes |
.align-content-[breakpoint]-[value] |
Responsive variations of .align-content-[value] classes. Options for [breakpoint]: sm , md , lg , xl , xxl screen sizes |