六维教程

Bootstrap5 位置

快速配置元素的位置。

固定位置

固定顶部

将元素固定在视口的顶部。

<div class="fixed-top">...</div>

固定底部

将元素固定在视口的底部。

<div class="fixed-bottom">...</div>

粘性位置

粘性顶部

将元素定位在视口的顶部,当滚动到顶部时,元素会固定在顶部。

<div class="sticky-top">...</div>

响应式粘性顶部

表现形式同sticky-top,同时支持响应式。例如sticky-md-top表示在中等屏幕及以上的视口大小下,元素才会固定在顶部。

<div class="sticky-sm-top">Stick to the top on viewports sized SM (small) or wider</div>
<div class="sticky-md-top">Stick to the top on viewports sized MD (medium) or wider</div>
<div class="sticky-lg-top">Stick to the top on viewports sized LG (large) or wider</div>
<div class="sticky-xl-top">Stick to the top on viewports sized XL (extra-large) or wider</div>
<div class="sticky-xxl-top">Stick to the top on viewports sized XXL (extra-extra-large) or wider</div>

粘性底部

将元素定位在视口的底部,当滚动到底部时,元素会固定在底部。

<div class="sticky-bottom">...</div>

响应式粘性底部

表现形式同sticky-bottom,同时支持响应式。例如sticky-md-bottom表示在中等屏幕及以上的视口大小下,元素才会固定在底部。

<div class="sticky-sm-bottom">Stick to the bottom on viewports sized SM (small) or wider</div>
<div class="sticky-md-bottom">Stick to the bottom on viewports sized MD (medium) or wider</div>
<div class="sticky-lg-bottom">Stick to the bottom on viewports sized LG (large) or wider</div>
<div class="sticky-xl-bottom">Stick to the bottom on viewports sized XL (extra-large) or wider</div>
<div class="sticky-xxl-bottom">Stick to the bottom on viewports sized XXL (extra-extra-large) or wider</div>
上一篇
Bootstrap5 列表组
下一篇
Bootstrap5 背景