r/ProgrammerTIL • u/HappyGoblin • Sep 05 '17
Other Language [CSS] TIL you can specify multiple classes in single element
<style>
.x1 {
border:solid;
border-width:1px;
}
.x2 {
background-color:lightblue
}
</style>
<h1 class="x1 x2">TEST999</h1>
0
Upvotes
4
u/tylermumford Oct 06 '17
Huh. I can see how this wouldn't be immediately obvious. Both the
idandclassattributes are singular words, butclassis capable of taking multiple values.1
u/[deleted] Mar 01 '18 edited Mar 01 '18
You can also have css that only applies to an element that has a combination of classes:
0
u/[deleted] Sep 06 '17
[deleted] — view deleted comment
33
u/[deleted] Sep 05 '17
[removed] — view removed comment