I have a navigation bar with multiple <a> links. Only one has the selected class at any given time:
<a href="#">Home</a>
<a href="#" class="selected">Preferences</a>
<a href="#">Log Out</a>
I’d like the :hover and .selected styles to look the same. Currently I’m using:
#navigation a.selected, #navigation a:hover {
...
}
Is there a simpler way of combining the two selectors, or is this the best way of doing it?
There is no way to combine the same style for a class and the hover selector, your current approach is fine.