What you are asking for is how CSS works by default.
The right way to style elements that donβt have a specific class assigned to them is the style of the base element, as Asshan showed above. I do not know why he got down.
h2 { property: value; }
Note that if H2 elements have classes assigned to them, then this style can override your base style.
So, if you have: h2 { color:#333; font-size:2em; } h2 { color:#333; font-size:2em; } h2 { color:#333; font-size:2em; } as the base style, and then apply class="myClass" , where: .class { color: #000; } .class { color: #000; } , then the color of the base style will be overridden (but not the font size). This is a cascade in cascading style sheets.
Another way is to conditionally configure them:
div#nav h2:first-child { property:value; }
which gives you contextual control, but again, the purpose of the class will always override the base style and can also override contextual targeting if the class application has a higher specificity.
user164226
source share