I was wondering if we could add 2 classes in one component.
The reason is that I need to add a active
class and a categories
class for my sideBar
is there any posibility of adding 2 classes or an alternative way?
heres the code I want to add 2 classes to:
<li><a id="Classic" >Classical Music</a></li>
CodePudding user response:
Just add a space to every class, e.g.
.para {
font-size: larger;
margin-bottom: 35px;
background-color: lightgreen;
}
.second_para {
color: red;
}
<body>
<p >
Hello there.
</p>
<p >
Same but in red.
</p>
</body>
CodePudding user response:
Yes you can!
<li><a id="Classic" >Classical Music</a></li>
Just keep a space between the classes.
You can add different classes to one element and one class to different elements as well.
But an element can't have more than one ID and an ID can't be used more than once in a page.
Thanks and best regards!