html - 垂直 div 和对齐之间的空间
问题描述
我对 div 间距有一些问题。这是html:
<div class="row">
<div class="col-lg-4">
<div class="checkbox checkbox-circle checkbox-business">
<input id="checkbox-business-id" class="styled" type="checkbox">
<label for="checkbox-business-id">BUSINESS</label>
</div>
<div class="checkbox checkbox-circle checkbox-health">
<input id="checkbox-health-id" class="styled" type="checkbox">
<label for="checkbox-health-id">HEALTH</label>
</div>
<div class="checkbox checkbox-circle checkbox-science">
<input id="checkbox-science-id" class="styled" type="checkbox">
<label for="checkbox-science-id">SCIENCE</label>
</div>
<div class="checkbox checkbox-circle checkbox-technology">
<input id="checkbox-technology-id" class="styled" type="checkbox">
<label for="checkbox-technology-id">TECHNOLOGY</label>
</div>
</div>
</div>
和 CSS:
.checkbox-business {
margin-top: 10px;
}
.checkbox-health {
margin-top: 10px;
}
.checkbox-science {
margin-top: 10px;
}
.checkbox-technology {
margin-top: 10px;
}
我想在 div 之间留出一些空间,并且我希望所有复选框都对齐。我无法做到这一点。另外,我正在使用引导程序。
有人可以看看吗?
解决方案
添加以下样式。这应该做你想做的
header.masthead {
text-align: left;
}
.checkbox {
margin-bottom: 20px;
height: 30px;
}
.checkbox label::before {
width: 30px;
height: 30px;
}
.checkbox label::after {
padding-top: 3px;
padding-left: 5px;
}
.checkbox input {
width: 20px;
height: 16px;
}
.checkbox input[type="checkbox"]:checked + label::after, .checkbox input[type="radio"]:checked + label::after {
font-family: "FontAwesome";
content: "\f00c";
font-size: 18px;
padding: 1px 5px;
}
.checkbox label {
padding-left: 20px;
line-height: 30px;
}
在此处检查更新的代码
推荐阅读
- ubuntu - 如何更改 RTSP 采样率
- python - plotly.express,直方图和折线图
- mysql - 在 mysql node.js 上运行长时间运行的任务后,我的 var/lib/mysql 文件夹已满
- javascript - 使用useState和useEffect每8秒更新一次滚动位置?
- outlook - MS Teams 中的日历未与 Outlook 同步
- asp.net-mvc - 如何在所有其他控制器mvc5中重用一个控制器中填充的对象
- pm2 - 如何使用 arg 中的空格将参数传递给 PM2
- sonarcloud - Sonarcloud:如何更新多个项目的设置
- excel - 在Excel中获得排名位置的方法
- spring-boot - 如何在 Spring Boot 中为电子商务 Web 应用添加购物车功能?