如何使这些复选框排成一排?
我正在尝试以类似网格的格式从复选框中进行清单,但是很难获得顶级的复选框,这是唯一带有标签的复选框,与其余的复选框相对。看来Checkbox在顶部的标签长度分开了,因此我认为我只需要找到导致它并删除它的代码的一部分,但是我似乎找不到它。有人可以帮我吗?代码下方。
<head>
<style>
.checkboxes input{
margin: 10px 20px 10px 20px;
}
ul{
display: flex;
align-items: flex-start;
justify-content: center;
margin:0px; padding:0px;
}
ul li{
display: flex;
align-items: center;
justify-content: center;
flex-wrap:wrap;
}
ul li label{ text-align:center; display:block; width:100%;}
</style>
<center>
</head>
<body>
<br><br><br>
<ul>
<li>
<label>Inspect</label><input type="checkbox">
</li>
<li>
<label>Repair</label><input type="checkbox">
</li>
<li>
<label>New Part</label><input type="checkbox">
</li>
<li>
<label>Unit Exch</label><input type="checkbox">
</li>
</ul>
<div class="checkboxes">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<br>
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<br>
</body>
I am trying to make a checklist out of checkboxes in a grid-like format, but am having trouble getting the top row of checkboxes, which are the only ones with labels, to line up with the rest. It looks like the checkboxes up top are spaced apart based on their label length, so I think I just need to find the portion of the code that causes that and remove it, but I cannot seem to find it. Can someone help me? The code is down below.
<head>
<style>
.checkboxes input{
margin: 10px 20px 10px 20px;
}
ul{
display: flex;
align-items: flex-start;
justify-content: center;
margin:0px; padding:0px;
}
ul li{
display: flex;
align-items: center;
justify-content: center;
flex-wrap:wrap;
}
ul li label{ text-align:center; display:block; width:100%;}
</style>
<center>
</head>
<body>
<br><br><br>
<ul>
<li>
<label>Inspect</label><input type="checkbox">
</li>
<li>
<label>Repair</label><input type="checkbox">
</li>
<li>
<label>New Part</label><input type="checkbox">
</li>
<li>
<label>Unit Exch</label><input type="checkbox">
</li>
</ul>
<div class="checkboxes">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<br>
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
<br>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下,不使用Flexbox来获得一致的行为,
Try this, not using flexbox to get consistent behaviour,