CSS不会更改DIV中链接的字体颜色

Mik*_*ike 3 html css

不确定我缺少什么,但我的HTML忽略了我的链接的CSS样式表规范.我的所有其他CSS定义在整个页面中都能正常工作.任何帮助是极大的赞赏!

我的CSS页面包括:

.footer {
    background:url( );
    margin:0;
    height:70px;
    clear:both;
}

.footer {
    margin:0;
    padding:10px;
    line-height: 175%;
    font:normal 11px helvetica, arial, sans-serif;
    color:#999;
}

a.footer {
    font:normal 11px helvetica, arial, sans-serif;
    color:#999;
    line-height: 175%;
}

a.footer:link {
    outline:none;
    text-decoration:none;
}

a.footer:visited {
    outline:none;
    text-decoration:none;
}

a.footer:hover {
    text-decoration:underline;
    font-weight:normal;
}
Run Code Online (Sandbox Code Playgroud)

我的网页包括:

<div class="footer">
<a href="http://www.someurl.org"> Page Title 1</a><br />
<a href="http://www.someurl.org/credits_policies.html">Page Title 2</a>
</div>
Run Code Online (Sandbox Code Playgroud)

dpp*_*dpp 10

全部更改a.footer.footer a

  • a.footer意味着所有<a>与课堂footer
  • .footer a意味着<a>在一个元素中,类footer是你的<div>.

你的CSS应该是这样的:

.footer a { font:normal 11px helvetica,arial,sans-serif; color:#999; line-height: 175%; } 

.footer a:link { outline:none; text-decoration:none; }

.footer a:visited { outline:none; text-decoration:none; }

.footer a:hover { text-decoration:underline; font-weight:normal; }
Run Code Online (Sandbox Code Playgroud)

以下是类选择器和后代选择器的一些教程:

http://www.w3.org/TR/CSS2/selector.html#class-html

http://www.w3.org/TR/CSS2/selector.html#descendant-selectors