Detailed explanation of the four hidden methods of css code

小云云
Release: 2017-12-13 11:37:53
Original
2737 people have browsed it

1.opacity:0 only hides the element, but still occupies the layout, so it still affects the layout

<pclass="p1">
snda:opacity:0只是把元素隐藏起来了 ,但是还是占有布局,所以还是对布局有影响
</p>
<p>ppskdkad</p>
Copy after login


.p1{
opacity:0;
width:200px;
height:200px;
border:1pxsolidred;
}
Copy after login

2.visibility: hidden still just hides the element, but still occupies the layout

<pclass="p2">
这是第二个p visibility:hidden还是只是把元素隐藏了,但是还是占有布局
</p>
<p>看看效果</p>
Copy after login
.p2{
visibility:hidden;
width:200px;
height:200px;
border:1pxsolidred;
}
Copy after login



3.display:none will not Affects the layout

<pclass="p3">
这是第三个p display:none不会影响到布局
</p>
<p>不信你看</p>
Copy after login
.p3{
display:none;
width:200px;
height:200px;
border:1pxsolidred;
}
Copy after login

4.position:absolute will not affect the layout

<pclass="p4">
这个是第四个p 我觉得也不会影响到布局 但是到底会不会 一起来看看吧 果然这个也不会影响到布局
</p>
<p>看看</p>v
Copy after login
.p4{
position:absolute;
top:-9999px;
left:-9999px;
width:200px;
height:200px;
border:1pxsolidred;
}
Copy after login

Have you learned the above four hiding methods? Hurry up and give it a try.

Related recommendations:

Comprehensive summary of attribute value inheritance knowledge in CSS

Comprehensive methods of customizing text omission in pure CSS

20 Advanced CSS Tips Summary

The above is the detailed content of Detailed explanation of the four hidden methods of css code. For more information, please follow other related articles on the PHP Chinese website!

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