,所以我有一个加载PDF的锚元素。但是,加载PDF后,悬停样式被卡住,直到我单击屏幕上的其他位置为止。在这一点上,它可以恢复正常。没有JS,这是CSS:
.my-btn {
color: #3568c4;
background-color: transparent;
border-color: #3568c4;
}
.my-btn:hover {
background-color: #3568c4;
color: white;
}
我相信浏览器默认值正在妨碍您重置它们或使用定义的类设置它们
a:悬停在a:链接和a:在CSS定义中访问a: 为了有效!
a:Active必须在A:CSS定义中的悬停才能出现才能成为 有效!
伪级名称不是案例敏感的。
.my-btn,
.my-btn:visited {
color: #3568c4;
background-color: transparent;
border-color: #3568c4;
}
.my-btn:hover {
background-color: #3568c4;
color: white;
}
.my-btn:active {
color: #3568c4;
background-color: transparent;
border-color: #3568c4;
}
<p>Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective! </p>
<p>a:active MUST come after a:hover in the CSS definition in order to be effective! </p>
<p>Pseudo-class names are not case-sensitive.</p>
<button class="my-btn">Test</button>