0

CSS の優先順位について検索して読んでいますが、正しいコードを持っていると思いますが、機能しません。class='green' のリンクを除いて、すべてのリンクを青で表示したいと考えています。CSS コードは次のとおりです。

a.green :link{
    color: green;
    text-decoration: none;
}
a.green :visited{
    color: green;
    text-decoration: none;
}
a:link {
        color: blue;
        text-decoration: none;
}   
a:visited {
        color: blue;
        text-decoration: none;
}
a:hover {
        color: orange;
        font-style: italic;
} 

しかし、その結果、すべてのリンクが青色で続きます。どんな助けでも大歓迎です。

4

1 に答える 1

6

スペースを削除する必要があります。

a.green:link{
    color: green;
    text-decoration: none;
}
a.green:visited{
    color: green;
    text-decoration: none;
}

そうしないと、要素内:linkの/:visited要素を探すことになり、意味がありません。 a.green

于 2013-08-29T18:46:37.723 に答える