绝对定位的链接在单击时转移到意外位置(a:活动)

发布于 2024-09-26 22:24:47 字数 533 浏览 1 评论 0原文

我在此页面上有几个链接 (http://tuscaroratackle.com),这些链接最终出现在其意想不到的位置:活动状态。这些链接是绝对定位的,所以我猜这个问题部分是由于这个原因造成的。但我无法弄清楚 :active 上应用了哪些规则来使它们向下和向左移动到目前为止。我确实有一条规则,使它们在活动时有点“压抑”( a:active {position:relative; top:1px;} ),但不太明白为什么它们转移得如此严重。

有问题的链接如下:

tusc-tkl-bug

这是悬停时出现的“See Rods”链接。如果您单击,您会看到尴尬的结果定位。

对于那些不知道的人(我最近发现),您可以检查 firefug 中的 :active 状态。只需使用样式选项卡上的下拉箭头即可打开这些样式。

I have a couple links on this page (http://tuscaroratackle.com) that are ending up at unexpected positions in their :active state. The links are absolutely positioned, so I'm guessing the issue is partly due to that. But I can't figure out what rules are getting applied on :active to make them shift down and to the left so far. I do have one rule that makes them "depress" a bit on active ( a:active {position:relative; top:1px;} ) but can't quite figure out why they are shifting so badly.

The links in question are these:

tusc-tkl-bug

it's the "See Rods" link that appears on hover. If you click you'll see the awkward resulting positioning.

Also for those that don't know (I recently found out) you can inspect the :active state in firefug. Just use the drop down arrow on the style tab to toggle those styles on.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落日海湾 2024-10-03 22:24:47

来自position:absolute的描述:
生成一个绝对定位的元素,相对于具有非 static 位置的第一个父元素定位。

并且,正如您所指出的,您已为 < 定义了 position:relative;代码>a:活动。因此,现在,在 中,span 的组合位置是相对于 的位置进行计数的。 a,而不是 .hp-promo-item 的位置。

至于解决方案,如果您需要在 :active 上将 a 向下移动 1 个像素,也许 margin-top 会更好。但是等等,您已经有了 .promo-content .iconmargin-top:1px。好吧,也许是 margin-top:2px !important; 那么。我真的不明白提出更多建议的目的。

PS 感谢您介绍 firebug 中的 :active 助手,非常有用!

From description of position:absolute:
Generates an absolutely positioned element, positioned relative to the first parent element that has a position other than static.

And, as you noted, you have position:relative; defined for a:active. Now, therefore, in <a><span></span></a> combination position of span is counted relative to position of a, not to position of .hp-promo-item.

As for solution, if you need to move a down 1 pixel on :active, maybe margin-top will work better. But wait, you already have margin-top:1px for .promo-content .icon. Well, maybe margin-top:2px !important; then. I don't really understand the aim to suggest more.

PS Thanks for telling about :active helper in firebug, pretty useful!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文