MDN’s new design is in Beta! A sneak peek:




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属性


Specification Status Comment
WHATWG HTML Living Standard
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
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,