为 a:hover、文本位置赋予 100% 宽度
这可能很愚蠢或很容易做到,但我不知道如何更改文本位置,而不影响悬停效果(它的宽度是精确的大小,因为它是父 div/透明块)。为了更好地理解这里的示例图像。
- 悬停时,红色标准杆将生效。
- 蓝色块是内容在顶部,因此红色条在其下方消失,但由于 100%,它现在显示在两侧 透明块。
- 最后,黄色块是放置 需要放置导航(同样,悬停状态不会改变)
真的,我没有想法,或者更准确地说,不知道如何做到这一点。用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.
- On hover, red par is set in action.
- 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. - Finally, yellow block is place where the
navigation needs to be placed (again, hover state doesn't changes)
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,我建议使用 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.