[英]How to Link To a Border Instead of <p>, <h1>, <h2>, etc
I have a long one-page HTML webpage with anchored links (llorch.org). 我有一个很长的一页HTML网页,上面有锚定链接(llorch.org)。 But I want links to the blue border instead of h2.
但是我想要链接到蓝色边框而不是h2。
<h2><a name="AboutMe">Sobre mí</a></h2>.
In order to make that possible, I tried to link to div instead of h1. 为了使之成为可能,我尝试链接到div而不是h1。 So.
所以。
<a name="expositio1"><div class="expositio"></a>
<h2><a name="AboutMe">Sobre mí</a></h2>
And it works: http://jsfiddle.net/jv4cK/ 它的工作原理是: http : //jsfiddle.net/jv4cK/
But it's not validated. 但这未经验证。
Is there another way to link to a border? 还有另一种链接到边界的方法吗? Oh, I forgot to say: it works in every browser, except IE.
哦,我忘了说:它适用于除IE之外的所有浏览器。 IE makes this weird border above the blue one.
IE浏览器使这个奇怪的边框高于蓝色。
Where you currently have: 您目前所在的位置:
<div class="expositio"><a name="expositio2"></a>
Adjust it to use: 调整使用:
<div class="expositio" id="expositio2">
The existing bookmark for #expositio2
should jump to an element with this id. #expositio2
的现有书签应跳转到具有此ID的元素。 Using the name
attribute is actually deprecated, so using an id is the correct way to do this. 实际上不建议使用
name
属性,因此使用id是正确的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.