【发布时间】:2023-03-05 14:31:01
【问题描述】:
我有一个基本的自定义复选框,我需要该框更改状态以在单击该框时选中,但它不起作用。有人可以帮我找出问题吗?
input[type=checkbox] {
display: none;
}
input[type=checkbox] + .accord-text:before {
display: block;
content: "☐";
width: 30px;
height: 30px;
color: green;
}
input[type=checkbox]:checked + .accord-text:before {
content: "☑";
}
<lable for='product-45-45'>
<input type='checkbox' style="float:right;"/>
<div class="accord-text">
<strong>header:</strong> sub text
<strong>more text!</strong>
</div>
</lable>
【问题讨论】:
-
jsfiddle.net/9o0csh9u - 在这里工作。固定标签和 id 映射
-
我自己的,我从一个例子中得到了这个想法,但我已经从这个想法中构建了我自己的
-
@RahulB 不错的小提琴谢谢 +1