【发布时间】:2020-06-10 13:23:41
【问题描述】:
我在这里分享一支笔here 我在 div.container 中插入了 6 个 div.squares 我已经设置了 .squares css 属性 float:left 我的疑问是- 当我为 div.container 设置红色边框时,该边框不会覆盖 6 个 div(而是边框仅显示在正方形的顶部),如笔中所示 据我说,那个边框应该覆盖所有的正方形
Click on this link to see the pen
.square{
padding-bottom:30%;
width:30%;
margin:10px;
background-color:brown;
float:left;
}
.container{
height:100%;
max-width:600px;
margin:20px auto;
border:2px solid red;
height:auto;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
</div>
</body>
</html>
【问题讨论】:
标签: html css frontend css-float border