Skip to main content Skip to docs navigation

使用这些助手来快速配置元素的位置。

固定顶部

将一个元素定位在视口的顶部,从边到边。确保您了解项目中固定职位的后果;您可能需要添加额外的 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>