为 a:hover、文本位置赋予 100% 宽度

发布于 2024-12-20 13:43:31 字数 431 浏览 3 评论 0原文

这可能很愚蠢或很容易做到,但我不知道如何更改文本位置,而不影响悬停效果(它的宽度是精确的大小,因为它是父 div/透明块)。为了更好地理解这里的示例图像。

  1. 悬停时,红色标准杆将生效。
  2. 蓝色块是内容在顶部,因此红色条在其下方消失,但由于 100%,它现在显示在两侧 透明块。
  3. 最后,黄色块是放置 需要放置导航(同样,悬停状态不会改变)

http://i40.tinypic.com/imms6f.jpg // 低于 10res 点,对直接链接感到抱歉

真的,我没有想法,或者更准确地说,不知道如何做到这一点。用css也可以吗?

This might be silly or very easy to do, but I have no clue how to change text position, not affecting hover effect (it's width is exact size as it's parent div/transparent block). For better understanding here's example image.

  1. On hover, red par is set in action.
  2. Blue block is content going on top, so that red bar disapears under it, but having 100%, it's now shows on both side of
    transparent block.
  3. Finally, yellow block is place where the
    navigation needs to be placed (again, hover state doesn't changes)

http://i40.tinypic.com/imms6f.jpg     // having under 10res points, sorry about direct link

Really, I'm out of ideas, or to be more precise, without any idea on how to do it. Is it even possible with css?

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

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

发布评论

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

评论(1

つ低調成傷 2024-12-27 13:43:32

如果我理解正确的话,我建议使用 padding-left css 属性。它不会改变您悬停的情况,如果您将填充设置为蓝色矩形的宽度+其右侧溢出部分的宽度之和,您就可以将文本放在您想要的位置。

将 padding-left 设置为红色矩形。

If I understand you correctly I recommend using padding-left css property. It does not change you hover and if you set the padding as a sum of width of the blue rectangle + width of its right overflowing part, you get your text where you want to.

Set padding-left to he red rectangle.

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