标签:oom meta erb overflow flow margin text inner tle
清除浮动:让浮动子元素撑开父级的高度
参考案例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="font/style.css">
<style type="text/css">
* {
margin: 0;
padding: 0;
}
#inner {
float: left;
width: 200px;
height: 200px;
background-color: dodgerblue;
}
#wrap {
border: 1px solid;
}
</style>
</head>
<body>
<div id="wrap">
<div id="inner">
</div>
</div>
</body>
</html>
overflow: hidden
或者float: left
<div id="wrap">
<div id="inner">
</div>
<br clear="all">
</div>
4.空标签清除浮动
<div id="wrap">
<div id="inner">
</div>
<div style="clear: both"></div>
</div>
5.伪元素:
.clearfix {
*zoom: 1;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
注:浮动盒子与定位盒子的宽高均由内容撑开
标签:oom meta erb overflow flow margin text inner tle
原文地址:https://www.cnblogs.com/kanaliya/p/12289785.html