MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

hidden

这篇翻译不完整。请帮忙从英语翻译这篇文章

全局属性hidden是一个布尔属性,表示一个元素尚未或者不再相关。例如,它可以被用来隐藏一个页面元素直到登录完毕。如果一个元素设置了hidden属性,它就不会被显示。

The hidden attribute must not be used to hide content that could legitimately be shown in another presentation. For example, it is incorrect to use hidden to hide panels in a tabbed dialog, because the tabbed interface is merely a kind of overflow presentation — one could equally well just show all the form controls in one big page with a scrollbar. It is similarly incorrect to use this attribute to hide content just from one presentation — if something is marked hidden, it is hidden from all presentations, including, for instance, screen readers.

隐藏元素不应与非隐藏元素链接,作为隐藏元素的后代的元素仍然是活动的,这意味着脚本元素仍然可以执行,表单元素仍然可以提交。

说明: 改变具有hidden属性的元素的CSS的 display 属性将覆盖该行为。 例如, 元素被设置为 display: flex 将会导致元素显示出来,尽管设置了hidden属性

Specifications

Specification Status Comment
WHATWG HTML Living Standard
hidden
Living Standard No change from latest snapshot, HTML5.1
WHATWG HTML Living Standard
Hidden elements
Living Standard Defines the suggested default rendering of the hidden attribute using CSS
HTML5.1
hidden
Recommendation Snapshot of WHATWG HTML Living Standard, initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 4.0 (2) 11 (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4 (Yes) 4.0 (2) 11 (Yes) (Yes)

See also

文档标签和贡献者

 此页面的贡献者: gaopu
 最后编辑者: gaopu,