【发布时间】:2016-07-20 07:15:18
【问题描述】:
我希望按钮中链接的颜色在悬停时为黄色,但它似乎不起作用,因为在悬停时,文本仍然是白色的。
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;
}
【问题讨论】:
-
您的代码工作正常,当我将其复制并粘贴到 jsfiddle 中时(这将是您的工作 - 请阅读 minimal reproducible example)。大概你有更多的 CSS 规则干扰它。
标签: css button text colors hover