不要将 CSS 应用于 label
本身,而是尝试将 CSS 应用于 HTML 中它们正下方的 <font>
标签。所以,在你的情况下,试试这个:
label[for=question1_1] > font,label[for=question1_2] > font,label[for=question1_3] > font,label[for=question1_4] > font {
color:#ED407B;
font-weight:600;
}
据我所知,您需要将 CSS 应用到每个 font
正下方的 label
标记。
如果上述方法不起作用,请尝试以下方法:
label[for=question1_1] font,label[for=question1_2] font,label[for=question1_3] font,label[for=question1_4] font {
color:#ED407B;
font-weight:600;
}
,
不起作用的原因:
您应该将 :checked
添加到 input 标签,因为它仅适用于 radio、checkbox 和 option(选择)被选中或切换到开启状态的元素。请参阅此documentation。
假设 label 元素位于 input[type="radio"] 元素之后,您可以使用:
input[type="radio"]:checked + label {
color:#ED407B;
font-weight:600;
}
让我知道这是否适合您:)
本文链接:https://www.f2er.com/190723.html