溢出(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
exampleon 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
溢出实用程序在我们的实用程序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,
),