
1、配合浮动父容器,解决父容器高度塌陷的问题。
2、利用overflow扩展盒子高度,overflow属性可以触发浏览器重新计算父元素盒子高度。
实例
<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8">
<style>
#wrap2{
width:55px;
border:3pxsolidred;
overflow:hidden;
}
.class1{
width:20px;
height:40px;
background:blue;
float:left;
}
.class2{
width:20px;
height:30px;
background:yellow;
float:left;
}
.class3{
width:20px;
height:30px;
background:fuchsia;
float:left;
}
.class4{
width:20px;
height:20px;
background:chartreuse;
float:left;
}
</style>
<title></title>
</head>
<body>
<divid="wrap2">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
以上就是css overflow属性的作用,希望对大家有所帮助。更多css学习指路:css教程
原文来自:https://www.py.cn© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END

















































暂无评论内容