| Class | Description |
|---|---|
| .fixed-top | 将元素固定在视口顶部。 |
| .fixed-bottom | 将元素固定在视口底部。 |
| .sticky{-$infix}-top | 以响应式方式将元素粘性固定在视口顶部。 |
| .sticky{-$infix}-bottom | 以响应式方式将元素粘性固定在视口底部。 |
固定顶部
将元素从边缘到边缘定位在视口顶部。请确保你了解固定定位在项目中的影响;你可能需要添加额外的 CSS。
<div class="fixed-top">...</div>
固定底部
将元素从边缘到边缘定位在视口底部。请确保你了解固定定位在项目中的影响;你可能需要添加额外的 CSS。
<div class="fixed-bottom">...</div>
粘性顶部
将元素从边缘到边缘定位在视口顶部,但仅在你滚动经过它之后。
<div class="sticky-top">...</div>
响应式粘性顶部
.sticky-top 工具类也有响应式变体。
<div class="sm:sticky-top">Stick to the top on viewports sized SM (small) or wider</div>
<div class="md:sticky-top">Stick to the top on viewports sized MD (medium) or wider</div>
<div class="lg:sticky-top">Stick to the top on viewports sized LG (large) or wider</div>
<div class="xl:sticky-top">Stick to the top on viewports sized XL (extra-large) or wider</div>
<div class="2xl:sticky-top">Stick to the top on viewports sized 2XL (extra-extra-large) or wider</div>
粘性底部
将元素从边缘到边缘定位在视口底部,但仅在你滚动经过它之后。
<div class="sticky-bottom">...</div>
响应式粘性底部
.sticky-bottom 工具类也有响应式变体。
<div class="sm:sticky-bottom">Stick to the bottom on viewports sized SM (small) or wider</div>
<div class="md:sticky-bottom">Stick to the bottom on viewports sized MD (medium) or wider</div>
<div class="lg:sticky-bottom">Stick to the bottom on viewports sized LG (large) or wider</div>
<div class="xl:sticky-bottom">Stick to the bottom on viewports sized XL (extra-large) or wider</div>
<div class="2xl:sticky-bottom">Stick to the bottom on viewports sized 2XL (extra-extra-large) or wider</div>