I am struggling to highlight the entire class element on hover. Even though I have specified the button class as a selector, only the background color of the anchor tag is changing when I hover over the button. What could be causing this issue and how can I change the background color of the entire li item (button class) on hover?
As a newcomer to web development, any helpful explanation would be greatly appreciated.
.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>