Pregunta

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}
¿Fue útil?

Solución

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)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top