Home > Web Front-end > HTML Tutorial > css的四种隐藏方式_html/css_WEB-ITnose

css的四种隐藏方式_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:15:31
Original
1057 people have browsed it

1.opacity:0只是把元素隐藏起来了 ,但是还是占有布局,所以还是对布局有影响


snda:opacity:0只是把元素隐藏起来了 ,但是还是占有布局,所以还是对布局有影响

ppskdkad

.div1{
opacity: 0;
width:200px;
height:200px;
border:1px solid red;
}

 

2.visibility:hidden还是只是把元素隐藏了,但是还是占有布局


这是第二个div visibility:hidden还是只是把元素隐藏了,但是还是占有布局

看看效果

.div2{
visibility: hidden;
width:200px;
height:200px;
border:1px solid red;
}

 

3.display:none不会影响到布局


这是第三个DIV display:none不会影响到布局

不信你看

.div3{
display: none;
width:200px;
height:200px;
border:1px solid red;
}

 

4.position:absolute不会影响到布局


这个是第四个div 我觉得也不会影响到布局 但是到底会不会 一起来看看吧 果然这个也不会影响到布局

看看

.div4{
position: absolute;
top:-9999px;
left:-9999px;
width:200px;
height:200px;
border:1px solid red;
}

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