首页 > 解决方案 > 悬停在按钮元素上不起作用

问题描述

希望这将是一件容易解决的事情,但我已经尝试寻找答案,但似乎没有什么合适的。

我正在尝试在按钮上制作悬停效果:

button {
min-width: 20vw;
max-width: 40vw;
border: none;
color: white;
font-size: 1.5vw;
padding: 15px 32px;
text-align: center;
text-decoration: none;
background-color: blue;
border-radius: 20px;
transition: 0.4s;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
.button:hover {
color: black;
background-color: lightcyan;
}

当我在浏览器(vivaldi & edge)中测试它时,没有任何变化。顺便说一下,测试站点是http://wyrdling.com/skulpturjagt

PS。我尝试使用 chrome 开发人员工具,但我太新手了,无法弄清楚如何阅读它 XD

标签: csshtmlhover

解决方案


除非您的问题中有错字,否则您使用.button:hover. 这将适用于具有hover. 换成button:hover


推荐阅读