Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set a default css class for an html element

Tags:

css

If I define a css class, is there anyway to set that class as a default class for an html element? To clarify, I was hoping to factor out the definition of the class so it could be used by one or more css selectors or applied discreetly in the html.

For example:

.myclass {float:right}
h1 {class: myclass}

The above does not work of course, but hopefully you know what I am asking as I have not been able to find how to do this.

like image 614
Dave Avatar asked Apr 20 '26 23:04

Dave


1 Answers

Not with standard CSS, but why not just do:

h1 {
    float: right;
}
like image 191
Evan Mulawski Avatar answered Apr 23 '26 14:04

Evan Mulawski