Bootstrap V5.3 中文手册

Position 定位

使用这些帮助程序快速配置元素的位置。

固定顶部

将元素从边缘定位到边缘的视口顶部。确保您了解项目中固定位置的后果;您可能需要添加其他 CSS。

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

固定底部

将元素放置在视口底部,从一个边缘到另一个边缘。确保您了解项目中固定位置的后果;您可能需要添加其他 CSS。

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

粘顶

将元素从边定位到边缘,但只能在滚动过去后将元素定位在视口顶部。

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

响应式粘性顶部

实用性也存在响应式变体。.sticky-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

<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>