我希望按钮上的链接颜色在悬停时为黄色,但它似乎不起作用,因为在悬停时,文本仍为白色。
HTML:
<button class="headerbutton headerbutton-style">
<a href="#">Learn More</a>
</button>
的CSS:
a, .headerbutton {
-webkit-transition: all 0.2s ease-in;
-moz-transition: all 0.2s ease-in;
-o-transition: all 0.2s ease-in;
}
.headerbutton {
font-family: "Open Sans";
font-weight: 400;
font-size: 12pt;
border-radius: 20px;
cursor: pointer;
padding: 15px 25px;
}
.headerbutton-style {
background-color: #FAD059;
border: 2px solid white;
}
.headerbutton-style:hover {
background-color: white;
color: #FAD05A;
}
.headerbutton a {
color: white;
text-decoration: none;
}
.headerbutton a:hover {
color: #FAD05A;
text-decoration: none;
}
答案 0 :(得分:0)
更改此规则
.headerbutton a:hover {
color: #FAD05A;
text-decoration: none;
}
到这个
.headerbutton:hover a {
color: #FAD05A;
text-decoration: none;
}
然后它会起作用。见http://codepen.io/anon/pen/RaLwEB