I'm having trouble changing the text color from white to black when hovering over the button. The code seems fine, but the text color isn't changing. Can anyone help me figure out how to make it work?
.main__btn {
font-size: 1.2rem;
background: rgba(0, 0, 0, 0);
padding: 15px 50px;
border-radius: none;
border-color: #fff;
margin-top: 2rem;
cursor: pointer;
position: relative;
transition: all 0.35s;
outline: none;
}
.main__btn a {
position: relative;
z-index: 2;
color: #fff;
text-decoration: none;
}
.main__btn:after {
position: absolute;
content: '';
top: 0;
left: 0;
width: 0;
height: 100%;
background: #ffffff;
transition: all 0.35s;
border-radius: 4px;
}
.main__btn:hover {
color: #000;
}
.main__btn:hover:after {
width: 100%;
}
<button class="main__btn" id="button1"><a href="#">button1</a></button>