如何导航到隐藏的锚点? [英] How do I navigate to hidden anchors?
本文介绍了如何导航到隐藏的锚点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的页面上有一个隐藏的元素,其ID为 select-box
:
I have a hidden element on my page with id select-box
:
<select style="display:none;" id="select-box">
页面顶部有一个< label>
:
<label for="select-box">Select box</label>
由于< select>
是隐藏的,因此单击< label>
无效.有没有办法做到这一点,最好不要使用任何JavaScript?
Because the <select>
is hidden, clicking on the <label>
has no effect. Is there a way to achieve this, preferably without using any JavaScript?
推荐答案
css功能显示:无;从文档中删除元素.
The css feature display:none; removes the element from the document.
尝试:
style="visibility:hidden; width:0px"
visibility:hidden将元素保留在dom中并且还占用空间,因此我给其提供了0px的宽度以确保不会留有空白.
visibility:hidden keeps the element in the dom and also takes up space so I've given a width of 0px to ensure no blank space will remain.
这篇关于如何导航到隐藏的锚点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文