Skip to main content Skip to docs navigation

能见性

使用可见性工具控制元素的可见性,而无需修改其显示。

使用我们的可见性工具设置元素的 visibility。这些工具类根本不会修改 display 值,也不会影响布局 - .invisible 元素仍然占用页面空间。

¥Set the visibility of elements with our visibility utilities. These utility classes do not modify the display value at all and do not affect layout – .invisible elements still take up space in the page.

Elements with the .invisible class will be hidden both visually and for assistive technology/screen reader users.

根据需要应用 .visible.invisible

¥Apply .visible or .invisible as needed.

<div class="visible">...</div>
<div class="invisible">...</div>
// Class
.visible {
  visibility: visible !important;
}
.invisible {
  visibility: hidden !important;
}

CSS

Sass 工具 API

¥Sass utilities API

可见性工具在 scss/_utilities.scss 中的工具 API 中声明。Learn how to use the utilities API.

¥Visibility utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

"visibility": (
  property: visibility,
  class: null,
  values: (
    visible: visible,
    invisible: hidden,
  )
),