【发布时间】:2017-01-24 20:26:30
【问题描述】:
我正在构建一个自定义复选框,功能差不多了,但样式还有一段路要走。
我有一些问题,
- 我需要以圆圈为中心的支票
- 我只需要在单击复选框本身而不是文本时激活检查。
恐怕如果不使用左侧位置的填充,我似乎无法将支票居中。
HTML
<label for='product-45-45'>
<input type='checkbox' style="float:left;" id='product-45-45' />
<div class="accord-text">
<strong>header:</strong> sub text
<strong>more text!</strong>
</div>
</label>
CSS
input[type=checkbox] {
display: none;
}
input[type=checkbox] + .accord-text:before {
width: 30px;
height: 30px;
border-radius: 200%;
background-color: #d6e4ec;
border: 1px solid #000;
display: block;
font-size: 150%;
font-weight: 900;
content: "";
color: green;
}
input[type=checkbox]:checked + .accord-text:before {
display: table;
content: "\2713";
}
【问题讨论】: