Domanda

Is it possible to target also another element like in the example ?

<a href="#AAA">click</a>
<div id="AAA">some content</div>
<div id="BBB">some content</div>

Something like...

#AAA:target #BBB{color:red}
È stato utile?

Soluzione

In this case, you could use the adjacent sibling combinator, +.

EXAMPLE HERE

#AAA:target + #BBB {
    color:red
}

Depending on the markup, it might be better to use the general sibling combinator, ~. (example)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top