input radio checked css code example

Example 1: checked radio button css

//html
<input id="rad1" type="radio" name="rad"/><label for="rad1">Radio 1</label>
<input id="rad2" type="radio" name="rad"/><label for="rad2">Radio 2</label>\

//css
input[type="radio"]:checked+label { font-weight: bold; }

Example 2: html radio button checked

<input type="radio" id="huey" name="drone" value="huey"
         checked> 
<!-- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio-->

Example 3: html radio only one checked

<!--Just manke both names equal -->
<input type="radio" name="options" id="1"/>
<input type="radio" name="options" id="2"/>

Tags:

Html Example