Utilities (4): Position / Screenreaders / Shadows / Sizing / Spacing
Utility classes for setting CSS position property (see CSS reference for detail). There is no responsive class.
.position-(static|relative|absolute|fixed|sticky)
Options for fixing an element on top or bottom, and displaying on topmost with setting Z-index . These are typically used for navigation bars . See navbar demos bellow for detail.
.sr-only to a element for screen reader users
.sr-only-focusable for screen reader users who use keyboardsAn example using .sr-only-focusable .
a.sr-only.sr-only-focusable
href="#"Skip to main contentWorking example: set inside the bracket next ⇒ ( Skip to main content ).
.shadow(-none|-sm|-lg)?
div.shadow-none
div.shadow-sm
div.shadow
div.shadow-lg
Utility classes for setting width and height.
.w-(25|50|75|100|auto).h-(25|50|75|100|auto).mw-100.mh-100Width example
.w-25.w-50.w-75.w-100.w-autoHeight example (in the parent with height:100px;)
.h-25.h-50.h-75.h-100.h-autoMax-width example: img.mw-100 (fits to the parent width)
Max-height example: img.mh-100 in the parent with height:200px; (fits to the parent height)
.min-vw-100.min-vh-100.vw-100.vh-100Min-width 100vw div.min-vw-100
Min-height 100vw div.min-vh-100
Width 100vw div.vw-100
Height 100vw div.vh-100
Utility for setting margins and paddings.
.(m|p)(t|b|l|r|x|y)?-(0|1|2|3|4|5|n1|n2|n3|n4|n5|auto)
(m|p) margin/padding
m sets margin
p sets padding
(t|b|l|r|x|y) direction
t sets top margin/padding
b sets bottom margin/padding
l sets left margin/padding
r sets right margin/padding
x sets left+right margin/padding
y sets top+bottom margin/padding
(0|1|2|3|4|5|n1|n2|n3|n4|n5|auto) width
0 sets to zero1 sets to 1/4rem
2 sets to 1/2rem
3 sets to 1rem
4 sets to 1.5rem
5 sets to 3rem
n1 (margin only) sets to -1/4rem
n2 (margin only) sets to -1/2rem
n3 (margin only) sets to -1rem
n4 (margin only) sets to -1.5rem
n5 (margin only) sets to -3rem
auto (margin only) uses browser default$spacer and its (default) value is 1rem (in source _variables.scss ). Size options 0,1,2... are also specified by the map variable $spacers .Setting paddings to table cell td (pb-(0|1|2|3|4|5) (Bottom only) is omitted by no effect)
.p-(0|1|2|3|4|5) (All)
.p-0 |
.p-1 |
.p-2 |
.p-3 |
.p-4 |
.p-5 |
.px-(0|1|2|3|4|5) (Left+Right)
.px-0 |
.px-1 |
.px-2 |
.px-3 |
.px-4 |
.px-5 |
.py-(0|1|2|3|4|5) (Top+Bottom)
.py-0 |
.py-1 |
.py-2 |
.py-3 |
.py-4 |
.py-5 |
.pt-(0|1|2|3|4|5) (Top)
.pt-0 |
.pt-1 |
.pt-2 |
.pt-3 |
.pt-4 |
.pt-5 |
.pl-(0|1|2|3|4|5) (Left)
.pl-0 |
.pl-1 |
.pl-2 |
.pl-3 |
.pl-4 |
.pl-5 |
.pr-(0|1|2|3|4|5) (Right)
.pr-0 |
.pr-1 |
.pr-2 |
.pr-3 |
.pr-4 |
.pr-5 |
Use .mx-auto for horizontal centering of a fixed width element.
div.mx-auto + style="width: 20rem;"Negative margins are typically used for adjusting grid column gutters (see Gutters). The example below demonstrates responsive gutter adjustment as follows.
div Attributes
.border.py-2div.row Attributes
.mx-md-n5div.col Attributes
.py-3.px-md-5.border.bg-whitediv Attributes
.bg-lightCustom column padding