【问题标题】:How to make visited links unvisited?如何使访问过的链接不被访问?
【发布时间】:2015-06-09 20:27:31
【问题描述】:

访问过的链接没有变为应有的颜色时遇到问题。应该下降的是,链接是黑色的,不透明度为 70%。当你将鼠标悬停在它上面时,它应该变成 100% 不透明度的 aliceblue。这仅适用于未访问的链接。被访问的链接应该和正常的链接完全一样,除了它们没有正确改变。

a{
transition: color 1s ease;
}

a:link {
display: inline-block;
margin-left: 20px;
color: rgba(0,0,0,0.7);
font-weight: 700;
font-size: 14px;
text-decoration: none;
font-family: arial;
text-transform: uppercase;
}

a:hover{
color: aliceblue;
text-decoration: none;
font-family: arial;
text-transform: uppercase;
}

a:visited{
transition: color 1s ease;
display: inline-block;
color: rgba(0,0,0,0.7);
margin-left: 20px;
font-weight: 700;
font-size: 14px;
text-decoration: none;
font-family: arial;
text-transform: uppercase;
}

【问题讨论】:

  • 我不知道天气我措辞错误,但我不希望访问的链接改变颜色。

标签: html css


【解决方案1】:

这是 CSS 中层叠样式的问题,如下所述:

https://stackoverflow.com/a/1536822/3990818

a:hover 必须放在a:linka:visited 规则之后

除非这样做,否则a:visited 将覆盖a:hover

您也可以在 http://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_link_more1 上通过重新排列不同的 CSS 规则来进行试验,作为此问题的简单测试场。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-30
    • 2018-11-02
    • 1970-01-01
    • 2015-05-25
    • 1970-01-01
    • 2012-01-01
    • 2011-10-28
    • 2016-03-26
    相关资源
    最近更新 更多