I here have 3 <input>s in my HTML:
Name: <input><br> Age: <input type="number"><br> Site: <input type="url"> And I can select the bottom two with these CSS:
input[type="number"]{ color: gray; } input[type="url"]{ color: blue; } But I don't know how to select the first one that has no type.
I tried:
input{ color: red; } But it will change the other two as well.
input[type=""]{ color: red; } This is still not working.
Any idea?
The :enabled pseudo-class in CSS selects focusable elements that are not disabled, and therefore enabled.
The selector input[type=""] will look for an input that has the attribute type which is set to empty. Try using this:
input:not([type]) { } See the jsFiddle.
Another approach could be to use CSS Specificity, and apply a general style to all input elements, then apply more specific styles to inputs with type attribute. :)
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