跳到主要内容 跳到文档导航

Overflow(溢出)

使用这些辅助实用程序来快速配置内容如何溢出元素。

Overflow

使用四个默认值和类别即时调整overflow属性。默认情况下,这些类不是响应式的。

This is an example of using .overflow-auto on an element with set width and height dimensions. By design, this content will vertically scroll.
This is an example of using .overflow-hidden on an element with set width and height dimensions.
This is an example of using .overflow-visible on an element with set width and height dimensions.
This is an example of using .overflow-scroll on an element with set width and height dimensions.
<div class="overflow-auto">...</div>
<div class="overflow-hidden">...</div>
<div class="overflow-visible">...</div>
<div class="overflow-scroll">...</div>

overflow-x

调整overflow-x属性以影响内容水平溢出。

.overflow-x-auto example on an element
with set width and height dimensions.
.overflow-x-hidden example
on an element with set width and height dimensions.
.overflow-x-visible example
on an element with set width and height dimensions.
.overflow-x-scroll example on an element
with set width and height dimensions.
<div class="overflow-x-auto">...</div>
<div class="overflow-x-hidden">...</div>
<div class="overflow-x-visible">...</div>
<div class="overflow-x-scroll">...</div>

overflow-y

调整overflow-y属性以影响内容垂直溢出。

.overflow-y-auto example on an element with set width and height dimensions.
.overflow-y-hidden example on an element with set width and height dimensions.
.overflow-y-visible example on an element with set width and height dimensions.
.overflow-y-scroll example on an element with set width and height dimensions.
<div class="overflow-y-auto">...</div>
<div class="overflow-y-hidden">...</div>
<div class="overflow-y-visible">...</div>
<div class="overflow-y-scroll">...</div>

使用 Sass 变量,您可以在_variables.scss更改$overflows.

Sass

实用程序接口

溢出实用程序在我们的实用程序 API 中声明scss/_utilities.scss了解如何使用实用程序 API。

    "overflow": (
      property: overflow,
      values: auto hidden visible scroll,
    ),
    "overflow-x": (
      property: overflow-x,
      values: auto hidden visible scroll,
    ),
    "overflow-y": (
      property: overflow-y,
      values: auto hidden visible scroll,
    ),