如何更改字体的颜色而不触发a:visited

时间:2013-12-03 02:18:17

标签: html css

现在我有以下HTML和CSS

<div id = "navi">
            <ul>
                <li><a id = "topLinks" class = "currentPage" href = "index.html"> Home </a></li>
                <li><a id = "topLinks" href = "blockOne.html"> Read </a></li>
                <li> Write </li>
                <li> Vote </li>
                <li> Donate </li>

            </ul>
        </div>

CSS:

#topLinks:hover, #topLinks:active{
color: black;   
}

.currentPage{   

color:#ce5438;
font-size: 40px;
}

问题是,如果我目前在Home上有我的网站,Home的颜色将是黑色(我想要的),但是如果我然后点击Read,那么home的链接将变成蓝色而不是回到白色。我尝试设置一个:访问到白色,但是它只是将我访问过的所有链接都更改为白色,无论我是否在页面上(当前页面上没有黑色字体颜色)。

请帮忙吗?

1 个答案:

答案 0 :(得分:0)

您只想定位导航中的链接:

#navi a.currentPage {
    color: #000;
}

#navi a:visited {
    color: #fff;
}