gpt4 book ai didi

html - 如何在不移动链接位置的情况下在链接前设置一些空格?

转载 作者:太空宇宙 更新时间:2023-11-04 01:43:25 25 4
gpt4 key购买 nike

我需要在鼠标悬停在其当前位置之前 5 个像素处突出显示一个 div。也就是说,如果用户将指针移到它上面,div 将在 5 个像素之前突出显示,但不会改变其内容位置。

.container {
width: 100%;
&:hover {
background-color: rgba(0, 0, 0, 0.1);
position: relative;
padding-left: 5px;
}
}
<div class='container'>
<a href='#'>Click me!</a>
</div>

将鼠标悬停在它上面会突出显示“点击我!”消息向右移动 5 个像素。我怎样才能做到这一点?

最佳答案

试试这个 SCSS

.container {
width: 100%;

&:hover {
background-color: rgba(0, 0, 0, 0.1);
position: relative;
padding-left: 5px;
a{
margin-left:-5px;
}
}
}

Link for reference

希望这对您有帮助..

关于html - 如何在不移动链接位置的情况下在链接前设置一些空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44972233/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com