For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/css/properties/visibility.md.
Lynx
  • 简体中文
  • visibility

    介绍

    CSS 属性 visibility 显示或隐藏元件而不更改文档的布局。

    使用示例

    语法

    /* Keyword values */
    visibility: visible;
    visibility: hidden;

    取值

    hidden,visible

    • visible 默认值,元件正常显示。

    • hidden 隐藏元件,但是其他元件的布局不改变,同时会隐藏其所有孩子,跟 opacity:0 效果类似。

    形式定义

    初始值visible
    适用元素all elements
    是否支持继承no
    是否支持动画yes

    形式语法

    visibility =
      visible   |
      hidden

    与 Web 的区别

    不支持 collapseinheritinitialunset 如果设置为 hidden,但其子元件设为 visibility: visible,则该子元件依然不可见

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。