Home > Web Front-end > H5 Tutorial > body text

How to make HTML5's hidden attribute compatible with old browsers_html5 tutorial tips

WBOY
Release: 2016-05-16 15:47:53
Original
1879 people have browsed it

Another new attribute is the hidden attribute. When a web page element has the hidden attribute, its behavior is very similar to CSS display: none; in that the element will disappear without occupying any page space. The writing method is very simple:

Copy the code
The code is as follows:


If you are using an old browser that does not support this attribute, you can add the following code in CSS To support it: :

Copy the code
The code is as follows:

* [hidden] { display: none; }


So, why use the hidden attribute? The meaning is that it is more semantically meaningful and improves the readability of the code. And compared to display:none in CSS, it’s literally simpler!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template