ITPub博客

首页 > IT职业 > IT职场 > css overflow属性有什么用

css overflow属性有什么用

IT职场 作者:yxl1108 时间:2021-09-11 09:46:24 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教程

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3158/viewspace-2828091/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-30

  • 博文量
    82
  • 访问量
    492