Note that this is different from the old question. How can I apply CSS to all the buttons that are on this page? because it is an existing style. Therefore, given that the style we will call "standard_label_style" already exists in the included CSS file, what can I do to say that all the labels on this page should have this style without adding:
class="standard_label_style"
for each of them? And yes, I know that I can apply ex-post-facto styles with jQuery or JavaScript code snippet. I'm just trying to find out how I should do this with CSS.
Follow up
I came up with a few comments that say that just use syntax like this .standard_label_style, shortcut ... Unfortunately this doesn’t mean anything that I want. This would allow me to apply additional rules to the standard_label_style class, as well as the rules for labels on this page, but would not allow me to apply this style to all labels on this page. To see an example of this, here is a stylesheet and html for demo. A label without a class will still not be red, but what I hope to do. I want to apply an existing class to all these labels on the page, and not just to the class and without adding a new style on this page, the existing style should be the only style.
included.css:
.standard_label_style { color: red; }
test.html:
<html> <head> <link rel="stylesheet" type="text/css" href="included.css"> <style> .standard_label_style, label { } </style> </head> <body> <label class="standard_label_style">Test Label</label><br/> <label>Unclassed Test Label</label> </body> </html>
John munsch
source share