我想在悬停时突出显示整个类元素。但我无法实现它。这就是正在发生的事情。
在按钮悬停时,只有标签的背景颜色发生变化,但我提供了选择器作为“按钮”类。这里出了什么问题?如何在悬停时更改按钮类(整个 li 项)的背景颜色?
我是 Web 开发的新手,将不胜感激。
.button {
height: fit-content;
width: 150px;
padding: 20px;
margin: 20px;
text-align: center;
background-color: gray;
font-family: Arial, Helvetica, sans-serif;
font-size: 20px;
color: white;
float: left;
border: 1px solid #ff0023;
}
.button :hover {
background-color: green;
}
<li class="button">
<a href="#aboutus">about us</a>
</li>
慕码人8056858
相关分类