Is there a way to apply a class by default to an element? Let’s say for example I wanted to apply the class foo to all input elements:
.foo { ... }
My limited knowledge leads me to believe I need to mark that up every single time:
<input type='text' class='foo' />
<input type='password' class='foo' />
...
But, clearly I was hoping I could apply that class by default to all input elements in the CSS somehow. I look forward to your answers!
UPDATE
In an attempt to clarify myself, I do not want to duplicate the CSS that already exists for foo because I wouldn’t want to have to change that in multiple places if I needed to change the style for foo. Further, I will be applying it to more than just all input elements.
If you mean you want to take all the styles in your
.foorule and apply them toinputs as well, just select both of them: