Xenonsoft
Active Member
This may seem pretty n00bish but I was just wondering if it was possible to have 2 classes on one element.
Turns out it is, all you have to do is have a space between them, inside one class declaration (i think that's the right word..).
Such as:
.this { background-color:#fff; font-size:14px; }
.left { float:left; }
<div class="this left">whatever</div>
Obviously that also shows that you can't have classes with spaces in.
Finally, the precedence goes from right to left, so if you had a conflict then the rules in .left {} would be applied. I assume Harry knew this but a few of us may not
EDIT: Wrong place, please move to Web Development.
Turns out it is, all you have to do is have a space between them, inside one class declaration (i think that's the right word..).
Such as:
.this { background-color:#fff; font-size:14px; }
.left { float:left; }
<div class="this left">whatever</div>
Obviously that also shows that you can't have classes with spaces in.
Finally, the precedence goes from right to left, so if you had a conflict then the rules in .left {} would be applied. I assume Harry knew this but a few of us may not
EDIT: Wrong place, please move to Web Development.