如何设置一个单选按钮状态来检查与CSS? [英] how to set a radio button state to checked with css?

查看:96
本文介绍了如何设置一个单选按钮状态来检查与CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组默认选中的单选按钮。像这样:

i have a group of radio buttons with a default checked one. like this:

    <input type="radio" name="radioButton" id="rd1" checked="">
    <input type="radio" name="radioButton" id="rd2">
    <input type="radio" name="radioButton" id="rd3">
    <input type="radio" name="radioButton" id="rd4">
    <input type="radio" name="radioButton" id="rd5">

我知道有些方法可以使用javascript添加checked属性。我的问题是如何使用css将选中的attr添加到选定的单选按钮?

i know there is ways to add checked attribute with javascript. my question is how to add checked attr to selected radio button with css?

推荐答案

如果您最初想要更改复选框,如果您想