我将如何处理?我无法使其填充侧面的空白,我只能在css中这样做(因此它也可以与浏览器缩放一起使用)
这是我的代码(简体),因为没有任何帮助,因此我提供了原始代码
<html>
<head>
<style>
#parent {
width: 1000px;
height: 1000px;
background-color: #0ff;
}
.child {
width: 400px;
height: 200px;
margin: 20px;
background-color: #f00;
float: left;
}
</style>
</head>
<body>
<div id="parent">
<div class="child"></div>
<div class="child"></div>
</div>
</body>
</html>
用 flexbox
#parent {
display: flex;
flex-wrap: wrap;
background-color: #0ff;
}
.child {
flex: 1 0 auto;
width: 400px;
height: 200px;
margin: 20px;
background-color: #f00;
}
<div id="parent">
<div class="child"></div>
<div class="child"></div>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句