品易云推流 关闭
文章详情页
文章 > css教程 > css overflow属性有什么用

css overflow属性有什么用

css Overflow

头像

小妮浅浅

2021-09-15 09:34:215560浏览 · 0收藏 · 0评论

1、配合浮动父容器,解决父容器高度塌陷的问题。

2、利用overflow扩展盒子高度,overflow属性可以触发浏览器重新计算父元素盒子高度。

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
#wrap2 {
width: 55px;
border: 3px solid red;
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>
<div id="wrap2">
<div></div>
 
<div></div>
 
<div></div>
 
<div></div>
 
</div>
</body>
</html>

以上就是css overflow属性的作用,希望对大家有所帮助更多css学习指路:css教程

本文教程操作环境:windows7系统、css3版,DELL G3电脑。

关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

底部广告图