定位

使用这些辅助类快速配置元素的位置。

ClassDescription
.fixed-top将元素固定在视口顶部。
.fixed-bottom将元素固定在视口底部。
.sticky{-$infix}-top以响应式方式将元素粘性固定在视口顶部。
.sticky{-$infix}-bottom以响应式方式将元素粘性固定在视口底部。

固定顶部

将元素从边缘到边缘定位在视口顶部。请确保你了解固定定位在项目中的影响;你可能需要添加额外的 CSS。

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

固定底部

将元素从边缘到边缘定位在视口底部。请确保你了解固定定位在项目中的影响;你可能需要添加额外的 CSS。

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

粘性顶部

将元素从边缘到边缘定位在视口顶部,但仅在你滚动经过它之后。

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

响应式粘性顶部

.sticky-top 工具类也有响应式变体。

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

粘性底部

将元素从边缘到边缘定位在视口底部,但仅在你滚动经过它之后。

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

响应式粘性底部

.sticky-bottom 工具类也有响应式变体。

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