开发者

Is it possible to control visibility of a div through anchor object with css?

开发者 https://www.devze.com 2023-03-23 09:49 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消