悬停在悬停的野生动物园元素,没有填充整个区域
为什么在野生动物园(ON:悬停)中,整个按钮不转到我的悬停颜色?
(我认为填充有问题)
---结果safari:
---导致Chrome(预期):
.btn,
a.btn{
background-color: #027BFF;
border-color: #007bff;
color: #fff;
border-radius: 0;
padding: 42px 20px;
transition: color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,box-shadow .2s ease-in-out;
transition-property: color, background-color, border-color, box-shadow;
transition-duration: 0.2s, 0.2s, 0.2s, 0.2s;
transition-timing-function: ease-in-out, ease-in-out, ease-in-out, ease-in-out;
transition-delay: 0s, 0s, 0s, 0s;
}
.btn:hover, a.btn:hover {
background-color: pink;
color: #fff;
box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 5%);
cursor: pointer;
}
<a href="#" class="btn btn-primary" onclick="javascript: something()"><span>Search</span></a>
Why in Safari (on :hover) not the whole button turns to my hover-color ?
(Something wrong with padding I assume)
--- Result in Safari:
--- Result in Chrome (expected):
.btn,
a.btn{
background-color: #027BFF;
border-color: #007bff;
color: #fff;
border-radius: 0;
padding: 42px 20px;
transition: color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,box-shadow .2s ease-in-out;
transition-property: color, background-color, border-color, box-shadow;
transition-duration: 0.2s, 0.2s, 0.2s, 0.2s;
transition-timing-function: ease-in-out, ease-in-out, ease-in-out, ease-in-out;
transition-delay: 0s, 0s, 0s, 0s;
}
.btn:hover, a.btn:hover {
background-color: pink;
color: #fff;
box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 5%);
cursor: pointer;
}
<a href="#" class="btn btn-primary" onclick="javascript: something()"><span>Search</span></a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在Safari中对
:Hover
也有类似的问题。在悬停时,我的按钮并未像您的示例那样完全填充。
我将错误缩小到我的
font-family
:body {font-family:inter,'arial narrow narrow bold',sans-serif; }
我已经通过fonts.bunny.net导入Inter Inter,如果我删除Inter并使用系统字体
:Hover
的行为,则按预期行为。当我使用导入字体的那一刻,问题又回来了。我能够通过使用切换到Google字体而不是fonts.bunny.net 来完全修复它。
I was having a similar issue with
:hover
in Safari. On hover, mya
button was not filling in completely like your example.I narrowed the bug down to my
font-family
:body { font-family: Inter, 'Arial Narrow Bold', sans-serif; }
I have Inter imported via fonts.bunny.net and if I remove Inter and use a system font the
:hover
behaves as expected. The moment I use an imported font, the issue comes back.I was able to fix it completely by using switching to Google Fonts instead of fonts.bunny.net
问题似乎是出于野生动物园的处理 box -shadow - &gt;
The problem seems to be with Safari's handling of box-shadow ->