سؤال

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}
هل كانت مفيدة؟

المحلول

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)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top