Skip to main content Skip to docs navigation

位置

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

固定顶

¥Fixed top

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

¥Position an element at the top of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.

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

固定底

¥Fixed bottom

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

¥Position an element at the bottom of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.

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

粘顶

¥Sticky top

将一个元素从一个边缘到另一个边缘放置在视口的顶部,但仅在滚动经过它之后才可以。

¥Position an element at the top of the viewport, from edge to edge, but only after you scroll past it.

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

响应式置顶

¥Responsive sticky top

.sticky-top 工具也存在响应式变体。

¥Responsive variations also exist for .sticky-top utility.

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

粘底

¥Sticky bottom

将一个元素从一个边缘到另一个边缘放置在视口的底部,但仅在滚动经过它之后才可以。

¥Position an element at the bottom of the viewport, from edge to edge, but only after you scroll past it.

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

响应式粘底

¥Responsive sticky bottom

.sticky-bottom 工具也存在响应式变体。

¥Responsive variations also exist for .sticky-bottom utility.

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