我想使用指向同一文档中 anchor 的链接来控制文档中 div 的可见性。我为什么要这样做?我希望能够通过 url 显示不同的内容。这可以通过 css 实现吗?
例子:
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>
最佳答案
使用 :target
selector .它相对较新 (CSS3),所以 doesn't work in all browsers .
关于html - 是否可以通过带有 css 的 anchor 对象来控制 div 的可见性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6862986/