James Dickens James Dickens - 1 year ago 77
CSS Question

The correct selector for all radio buttons Css

Is this the correct way to style radio buttons in CSS ?

input [type = radio] {

<!-- Css stuff -->


Answer Source

You should remove the spaces. They have meaning in CSS - something like "all elements within". So, your selector is performing an extra function that you don't want. It should be: input[type="radio"] instead.

Also, "correct" can have many meanings. For example, it might make more sense for you to change your HTML to <input type="radio" class="radio-btn"> and then use .radio-btn in your CSS, for example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download