I am trying to use a style where I use
input:not([type=checkbox]), input:not([type=radio]){ ...
But clearly that won't work. How can I use the styles I have written for all inputs but just these two?
In your code you need to add <label for="r2"><span></span>Radio Button 2</label> after creating radio and using my css code you can do this. @DipeshParmar using input[type="radio"] { display:none; } will take out keyboard access from the radio buttons.
It is possible to style a checkbox using Pseudo Elements like :before, :after, hover and :checked. To style the checkbox the user first needs to hide the default checkbox which can be done by setting the value of the visibility property to hidden. Example 1: Consider the example where HTML checkbox is styled using CSS.
You need to use a single combined selector instead of two selectors:
input:not([type=checkbox]):not([type=radio]) { ... }
This selects any input
element that does not have the attribute type=checkbox
and that does not have the attribute type=radio
. The code in the question, with two selectors, selects all input
elements that do not have the attribute type=checkbox
and additionally all input
elements that do not have the attribute type=radio
, so it ends up with selecting all input
elements.
Usual CSS Caveats apply. You may wish to use polyfill like Selectivzr to cover old versions of IE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With