Skip to content Skip to sidebar Skip to footer

CSS: Using :target To Change Css On Multiple ID's

I'm trying to pull off a pure HTML/CSS -based site, that uses :target to specify what to show. So i have a menu, with 3 tabs in, that when the target is equal to the ID, the tab is

Solution 1:

From CSS Selectors Level 3

http://www.w3.org/TR/selectors/#id-selectors

What makes attributes of type ID special is that no two such attributes can have the same value in a conformant document, regardless of the type of the elements that carry them; whatever the document language, an ID typed attribute can be used to uniquely identify its element.

So you can't have the same id set on two elements.

But maybe you could enclose both a menu item and a div in one element with the same ID? Otherwise this leaves you with just JavaScript.


Post a Comment for "CSS: Using :target To Change Css On Multiple ID's"