前端的学习之路:初级CSS---BFC的演示
程序员文章站
2022-05-10 11:03:07
...
BFC的演示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BFC的演示</title>
<!-- <link rel="stylesheet" href="../chujicss/css/11.21.04.css"> -->
<style>
.box1{
width: 200px;
height: 199px;
background-color: #bfa;
float: left;
/*外边距不会重叠*/
overflow: hidden;
/* 开启了BFC */
}
.box2{
width: 200px;
height: 200px;
background-color: orchid;
overflow: hidden;
}
.box3{
width: 100px;
height: 100px;
background-color: yellowgreen;
margin-top: 100px;
}
</style>
</head>
<body>
<div class="box1">
<div class="box3"></div>
</div>
<div class="box2"></div>
</body>
</html>
**运行结果为:
**
上一篇: 前端的学习之路:初级CSS---图标字体
下一篇: live555 权限认证代码