如何使用css水平对齐方框[已关闭]

cwdobuhd  于 2023-02-01  发布在  其他
关注(0)|答案(1)|浏览(112)

**已关闭。**此问题需要debugging details。当前不接受答案。

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
昨天关门了。
Improve this question
有谁能告诉我如何水平对齐这些框。我使用循环和获取输入使用渲染网址,你可以在屏幕截图中看到。
Screenshot.

avwztpqn

avwztpqn1#

我不知道你的HTML和CSS是什么,但是你可以使用flex来水平放置它们。如果你看下面的例子,我给了我的box容器一个displayflex来使它们水平。你也可以使用flex-direction: row;来确保它使用flex保持水平。如果有更多的问题,请告诉我!

html, body {
width: 100%;
height: 100%;
}

.box {
width: 100px;
height: 80px;
background-color: green;
}

.box_container {
/*Making it horizontal*/
display: flex;
gap: 10%;
}
<html>
<body>
<div class="box_container">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</body>
<html>

相关问题