答案 0 :(得分:0)
试试这个:
首先span
:
input:checked ~ span:first-of-type {
color: red;
}
input:checked ~ span:first-of-type {
color: red;
}
<input type="checkbox" name="">Click
<br><span>mohammedSerwan</span>
<br><span>Mohammed2</span>
对于所有span
,请使用~
:
input:checked ~ span {
color: red;
}
input:checked ~ span {
color: red;
}
<input type="checkbox" name="">Click
<br><span>mohammedSerwan</span>
<br><span>Mohammed2</span>