我的CSS是這樣的:重寫鏈接樣式
A:link { text-decoration: none; color: White; border-bottom:1px dotted white; font-style:italic;}
A:visited { text-decoration: none; color: White; border-bottom:1px dotted white; font-style:italic;}
A:active { text-decoration: none; color: White; border-bottom:1px dotted white; font-style:italic;}
A:hover { text-decoration: none; color: white; border-bottom:1px solid white; font-style:italic; }
#mainmenu A:link { text-decoration: none; }
#mainmenu A:visited { text-decoration: none; }
#mainmenu A:active { text-decoration: none; }
#mainmenu A:hover { text-decoration: underline; color: white; }
和HTML我有:
<div id="mainmenu">
<a href="link here">link</a>
</div>
我會認爲這菜單項將有沒有文字的裝飾風格,而是它獲取下劃線的風格。所以#mainmenu的樣式似乎被忽略,它總是採用默認樣式。
我錯過了什麼嗎?
什麼broswer你在查看此? –
firefox 7,但在IE中相同 –
'#id'樣式優先於'.class'樣式,它優先於'a'對象樣式。你可能想讓自己瞭解層疊樣式表的層疊部分:) –