锚链接落在错误的位置 [英] Anchor link landing in wrong position
问题描述
可能是一个愚蠢的问题,但老实说我无法解决这里出了什么问题。
Probably a stupid question, but I honestly can't wrap my head around what's going wrong here.
http://harrisonfjord.com/thinkinc/
我正在建设的网站。我想在 http://harrisonfjord.com/thinkinc/index.php#sponsors上建立一个锚点链接。我已经在下面的代码中设置了锚点:
A site I'm building at the moment. I want to make an anchor link at http://harrisonfjord.com/thinkinc/index.php#sponsors. I've set up the anchor to occur just before in the following code:
<a name="sponsors"></a>
<div class="sponsors">
<div class="sponsors-left">
<h2>Sponsors</h2>
<p>Support the lovely folks who support us! Visit their websites, join their mailing lists and peruse their wares. They are all highly-deserving of your custom, and we're thrilled to have each and everyone one of them on-board!</p>
</div>
然而,当你点击锚链接时,它会降低到div的一半。我认为在锚链接加载后加载图像可能会出现问题,所以我手动为所有标签添加宽度/高度。我也为标题栏中的cufon文本替换做了同样的事情。
However, when you click on the anchor link it lands about halfway down the div. I thought it might have been a problem with the images loading after the anchor link loads, so I manually put in widths/heights for all of the tags. I also did the same for the cufon text replacement in the title bar.
这些都没有帮助,所以现在我转向你。无论出于何种原因,锚也无法在Firefox中运行。我对这里做错了什么想法?
None of that helped, so now I turn to you. The anchor is also not working in Firefox, for whatever reason. Any thoughts on what I've done wrong here?
干杯!
推荐答案
我认为问题是由你没有使用内容的主播造成的。
I think the problem is resulting from the anchors with no contents that you are using.
此外,似乎 name =
弃用赞成 id =
作为某些元素(包括 A
)中的片段标识符,因为ID属性是唯一的,而NAME属性不是唯一的如此保证。
Also, it appears that name=
has been deprecated in favor of id=
as a fragment identifier in certain elements (including A
) which makes a kind of sense as ID attributes are unique whereas NAME attributes are not so guaranteed.
我会尝试在实际的可渲染实体中粘贴片段标识符,例如:
I'd try sticking the fragment identifier in the actual renderable entity such as:
<h2 id="sponsors">Sponsors</h2>
并查看它的位置。顺便说一下,它看起来像是一个很好的会议,我希望你得到一个comp录取。
and see where that gets you. Incidentally, it looks like a good conference, I hope you get a comp admission.
这篇关于锚链接落在错误的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!