我是刚刚发现CSS中的错误还是忽略了某些东西?

qua*_*ebs -1 html css

我在全球所有的链接都有这些样式.我无法在同一页面上覆盖div中的链接样式.

a, a:visited{
    outline: 0;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

a:hover{
    text-decoration: underline;
}
Run Code Online (Sandbox Code Playgroud)

现在我想覆盖锚点链接的样式,在悬停时将其颜色更改为白色,但只能看到看不见的多个类的div和像这样的通知容器......

<div class="unseen notificationContainer">                     
    <a href="profile?customerId=1365764036258">
        <strong>robert</strong>
    </a>
    sent you a friend request 
    <a href="friend_request?type=accept&amp;notificationId=1365764054463">
        Accept
    </a>
    <a href="friend_request?type=reject&amp;notificationId=1365764054463">
        Reject
    </a>          
</div>
Run Code Online (Sandbox Code Playgroud)

所以我将以下内容添加到我的CSS中

.unseen{
    background: #09f;
    color: #fff;
}

.unseen a :hover{
    color: #fff;
    text-decoration: underline;
}
Run Code Online (Sandbox Code Playgroud)

当页面加载悬停在第一个链接上时,将其颜色更改为白色,但其他三个颜色为背景的蓝色.过去一个小时我一直在这,而不仅仅是恼人的.notificationContainer的样式如下

.notificationContainer{
    width: 390px;
    float: left;
    border-bottom: solid 1px #eee;
    padding: 5px;
}
Run Code Online (Sandbox Code Playgroud)

提前致谢.

Bol*_*ock 7

CSS不可能有bug,只有浏览器可以(除非你指的是CSS规范中的错误等).

也就是说,这是您的代码中的错误,而不是浏览器:

.unseen a :hover{
    color: #fff;
    text-decoration: underline;
}
Run Code Online (Sandbox Code Playgroud)

之间的空间a:hover意味着任何元件:hover a,很像.unseen a装置a内的元件.unseen,这样就不会工作.您需要删除该空间:

.unseen a:hover{
    color: #fff;
    text-decoration: underline;
}
Run Code Online (Sandbox Code Playgroud)