Position
Use these shorthand utilities for quickly configuring the position of an element.
Common values
Quick positioning classes are available, though they are not responsive.
<div class="position-static">...</div>
<div class="position-relative">...</div>
<div class="position-absolute">...</div>
<div class="position-fixed">...</div>
<div class="position-sticky">...</div>
Fixed top
Position an element at the top of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add aditional CSS.
<div class="fixed-top">...</div>
Fixed bottom
Position an element at the bottom of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add aditional CSS.
<div class="fixed-bottom">...</div>
Sticky top
Position an element at the top of the viewport, from edge to edge, but only after you scroll past it. The .sticky-top
utility uses CSS's position: sticky
, which isn't fully supported in all browsers.
IE11 and IE10 will render position: sticky
as position: relative
. As such, we wrap the styles in a @supports
query, limiting the stickiness to only browsers that can render it properly.
<div class="sticky-top">...</div>
Position Property
Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.
The classes are named using the format {sides}-{size}
Where sides is one of:
t
- for classes that settop
b
- for classes that setbottom
s
- for classes that setstart/left
e
- for classes that setend/right
Where size is one of:
1
- (by default) for classes that set property to.25
2
- (by default) for classes that set property to.5
3
- (by default) for classes that set property to1
4
- (by default) for classes that set property to1.5
<div class="s-1">left 1rem</div>
<div class="e-2">right 2rem</div>
<div class="t-3">top 3rem</div>
<div class="b-4">bottom 4rem</div>
Position Property Percent
The classes are named using the format {sides}-{size}
Where sides is one of:
top
- for classes that settop
bottom
- for classes that setbottom
start
- for classes that setleft
end
- for classes that setright
Where size is one of:
1
- (by default) for classes that set property to10%
2
- (by default) for classes that set property to20%
3
- (by default) for classes that set property to30%
4
- (by default) for classes that set property to40%
5
- (by default) for classes that set property to50%
<div class="start-1">left 10%</div>
<div class="end-2">right 20%</div>
<div class="top-3">top 30%</div>
<div class="bottom-4">bottom 40%</div>