What is the difference between HTML5 hidden = "hidden" and CSS display: none? -

Source: Internet
Author: User
0 reply content:
There is no difference in the effect, but as long as the content written in CSS is purely displayed, it can not follow any principle (such as display, dogs can be disguised as monkeys ), HTML may contain semantics.

Hidden indicates that the element is irrelevant and unnecessary. This meaning is the main content. The effect of "hiding" is only included. It may seem like there is no difference with display: none, but there may be value in places we don't know, such as screen readers or all other places that depend on semantics.

For more information, see hidden-HTML (HyperText Markup Language) No matter what the situation is, you know a principle and it will be okay:

HTML indicates that the content is displayed with semantics, and CSS indicates that the interface style is related.

The property "hidden" indicates that it is irrelevant to the viewer and does not matter. The browser directly hides the property since it is irrelevant during parsing. If you have something unrelated to the user, such as the input of the submitted information, you can use hidden.

Display none is invisible from the interface and vision. If you need to temporarily hide something and switch it back, such as a drop-down menu, you can use display none. Because it is not unrelated to users, it cannot be displayed yet. No difference, almost identical.
So many html5 knowledge points need to be learned and mastered. It is recommended that you do not parse the details in such irrelevant places, which makes little sense.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.