0

Css

.techRadio {
    background: red;
    height: 15px;
}

HTML

<input type="radio" class="techRadio" checked="true" name="techBullet"/>
<input type="radio" class="techRadio" name="techBullet" />
<input type="radio" class="techRadio" name="techBullet" />

Whats wrong here?

Faizan
  • 766
  • 2
  • 7
  • 19

4 Answers4

1

As mentioned by dooxe, above, you really can't do much to style a radio button.

But there are many examples on the web of hiding the boring radio button and styling the label.

Here is one example of "extreme" styling - FIDDLE.

(Update with code for getting value of button - FIDDLE.)

HERE is the website with the code - and there are MANY other examples.

CSS for first example

input[type=radio] {
    display:none; 
    margin:10px;
}
input[type=radio] + label {
    display:inline-block;
    margin:-2px;
    padding: 4px 12px;
    background-color: #e7e7e7;
    border-color: #ddd;
}
input[type=radio]:checked + label { 
   background-image: none;
    background-color:#d0d0d0;
}
TimSPQR
  • 2,964
  • 3
  • 20
  • 29
0

I think that radio buttons (like checkboxes, and may be some others) styles cannot be changed because they depend on your navigator and OS. To use your own style, you can create your own radio buttons.

dooxe
  • 1,481
  • 12
  • 17
0

You can apply css to input radio button, but you can't change the background color.

Below code will change the border of radio button.

  <style>
.techRadio {

    outline:solid;
}
</style>
<input type="radio" style="backgroung-color:red" class="techRadio" checked="true" name="techBullet"/>
<input type="radio" class="techRadio" name="techBullet" />
<input type="radio" class="techRadio" name="techBullet" />
sud_shan
  • 195
  • 1
  • 11
0

You can place your radio buttons inside a div container. Then you can apply your CSS style in that div.

<div class="myDiv">
   <input type="radio" checked="true" name="techBullet"/>
   <input type="radio" name="techBullet" />
   <input type="radio" name="techBullet" />
</div>

In your CSS

.myDiv {
    background: red;
    height: 15px;
}
Tibs
  • 735
  • 5
  • 16