CSS Display:none Use notes Summary _ Experience Exchange
Source: Internet
Author: User
1, if in the style file or the page file code directly with Display:none to the elements of the hidden, load the page, in no way through JS set the element to display the premise, the use of JS code will not be able to get the elements of the correct attributes, such as offsettop, Offsetleft, and so on, the return value will be 0, through the JS set Style.display to make the element display to get these values correctly.
2, the use of display:none hidden elements will not be Baidu search site retrieval, will affect the site's SEO, in some cases can use left:-100000px to achieve the same effect.
3, if it is through the style file or <style>css</style> way to set the elements of the Display:none style, with JS set style.display= "" and can not make the element display, You can use block or inline equivalents instead. Settings that are made directly on the element by style= "Display:none" do not have this problem
4, In some cases, you can use style.visibility instead of style.display, but note that style.visibility hides the elements while preserving the space the elements occupy on the page, Style.display hiding the elements and giving up the space for the page.
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