James Dickens James Dickens - 8 months ago 37
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 -->



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.