2012-09-14 69 views
3

不知道我缺少什麼,但是我的HTML忽略了我的CSS樣式表規範的鏈接。 我的所有其他CSS定義在整個頁面中都能正常工作。 任何幫助,非常感謝!CSS不會更改DIV內鏈接的字體顏色

我的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; 
} 

我的網頁包括:

<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> 

回答

1

你想改變a.footer.footer a。您當前的CSS試圖設置具有「footer」類的鏈接樣式。

10

更改所有a.footer.footer a

  • a.footer意味着所有的「是」與類標籤「頁腳」
  • .footer a手段與類「頁腳」,這是你的「格」的元素中「一」的標籤。

你的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; } 

這裏有一流的選擇和後代選擇一些教程:

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

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

+0

+1進行了詳細的和很好的解釋回答。 – freebird

+0

哇 - 太容易了!感謝您的快速回復和解釋。 – Mike

0

應該

.footer a 
{ 
//your syles 
} 

目前CSS被應用到所有footer類,這是不是case.Your div的鏈接有類

Demo

0

更改所有a.footer.footer aa.footer是這裏沒有什麼這意味着應用a的風格與class footer

0

hi n流用於本

.footer a{ 
// your css here 
} 

和使用的標題這格式化

<a href="#" title="Your title here ">helo</a>