我在css开关上放置内容时遇到问题
这是我的代码
/* Css */
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
<!-- Html: -->
<label class="switch"></label>
<input type="checkbox" />
<div class="slider round"></div>
任何帮助都将受到高度赞赏
答案 0 :(得分:0)
使用adjacent sibling selector
和:checked selector
。例如:
div:before {
content: "";
}
input:checked + div:before{
content: 'foo';
}
&#13;
<input type="checkbox" />
<div></div>
&#13;