如何使用css更改div interestBTN
的背景?
我的css:
.interestBTN {
width: 50%;
height: 35px;
line-height: 35px;
border-color: #ACED52;
border-radius: 10px;
font-size: 18px;
color: black;
text-align: center;
margin: auto;
margin-bottom: 30px;
background-color: #ACED52;
}
div.interestBTN :hover {
background-color: black;
color: #ACED52;
}
HTML:
<a href="#"><div class="interestBTN"><strong>Open</strong></div></a>
提前感谢!
答案 0 :(得分:2)
您需要做的就是删除:hover
.interestBTN {
width: 50%;
height: 35px;
line-height: 35px;
border-color: #ACED52;
border-radius: 10px;
font-size: 18px;
color: black;
text-align: center;
margin: auto;
margin-bottom: 30px;
background-color: #ACED52;
}
div.interestBTN:hover {
background-color: black;
color: #ACED52;
}
<a href="#"><div class="interestBTN"><strong>Open</strong></div></a>
答案 1 :(得分:0)
.interestBTN {
width: 50%;
height: 35px;
line-height: 35px;
border-color: #ACED52;
border-radius: 10px;
font-size: 18px;
color: black;
text-align: center;
margin: auto;
margin-bottom: 30px;
background-color: #ACED52;
}
div.interestBTN:hover {
background-color: black;
color: #ACED52;
}
<a href="#"><div class="interestBTN"><strong>Open</strong></div></a>