html - Can i make a Text to an input radio with CSS? -


i have radio button , want make each 1 text value, think yes , no.

<input type="radio" name="tabgroup1" id="rad1" class="tab1" checked="checked"/>  <input type="radio" name="tabgroup1" id="rad2" class="tab2"/> 

i want khnow if can css make text these radios?

like :

.tab1{    content:'yes'; } .tab2{    content:'no'; } 

inputs aren't supposed have pseudo-elements per w3c spec although browsers have decided implement them anyway.

ideally should use actual text in label if chose not can use label anyway , put pseudo-element on that.

.tab1 + label:before {    content: 'yes';    display: inline-block;  }  .tab2 +label:before {    content: 'no';    display: inline-block;  }
<input type="radio" name="tabgroup1" id="rad1" class="tab1" checked="checked" />  <label for="rad1"></label>  <input type="radio" name="tabgroup1" id="rad2" class="tab2" />  <label for="rad2"></label>


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -