visibility:hidden和display:none的区别
都可以实现隐藏
visibility:hidden内容会隐藏但是位置会保留
display:none内容会被隐藏但是不保留位置
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.div1{width:100px; height:100px; background:#f00;}
.div2{width:100px; height:100px; background:#ff0; display:none;}
.div3{width:100px; height:100px; background:#0f0;}
.div4{width:100px; height:100px; background:#f00;}
.div5{width:100px; height:100px; background:#ff0; visibility:hidden;}
.div6{width:100px; height:100px; background:#0f0;}
</style>
</head>
<body>
dispaly隐藏
<div class="div1">1</div>
<div class="div2">2</div>
<div class="div3">3</div>
<br /><br />
visibility隐藏
<div class="div4">4</div>
<div class="div5">5</div>
<div class="div6">6</div>
</body>
</html>