Is it possible to control visibility of a div through anchor object with css?
I want to use a link pointing to a anchor in the same dokument to control the visibility of div's inside a dokument. Why do I want to do this? I want to be able to show different contents through the url. Is this possible through css?
Example:
index.html#test
<div id="test">This is visible</div>
<div id="not">This is not visible</div>
<div 开发者_高级运维id="may">May be visible through a css selector</div>
Use the :target
selector. It's relatively new (CSS3), so doesn't work in all browsers.
This isn't possible with just CSS. You would need to use JavaScript.
精彩评论