如何通过悬停更改整个 div 背景
How to change whole div background with hover
如何将 div interestBTN
的背景更改为 css?
我的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>
提前致谢!
您只需删除 :hover
之前的 space
.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>
.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>
如何将 div interestBTN
的背景更改为 css?
我的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>
提前致谢!
您只需删除 :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>
.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>