How to change <li> elements that are NOT active with pure CSS?
I understand how to change the description of the active element <li>
li:active {
...declarations...
}
But how can I change all other elements that are NOT active ?
For example, all my elements are shown in bold, but when I select one of them, all the rest return to their normal state.
Thank!
+3
5 answers
To expand Brad's answer based on your example:
You want everyone to <li>be bold until a button is pressed, right? Start with:
li {
font-weight: bold;
}
Then, if you click on a list item, keep it bold, but make the rest regular:
li:active ~ li {
font-weight: normal;
}
~ selects all the elements that are siblings of active li, without selecting the most active.
0