2012-10-04 79 views
-2

我已經有這個代碼在我的style.css(使用WordPress):我如何重寫錨標籤屬性?

a:link, a:visited { 
    color: #3088FF; 
    text-decoration: none; 
} 

我想改變錨文本的顏色,字體樣式,大膽等進行分類。我怎樣才能覆蓋這個?

回答

1
+0

HI, BUT I just wanna apply this anchor text CSS only to that particular anchors, my override CSS shouldnt change actual behavior of CSS.. So, does this !important; can only be used for specific anchor tags..? –

+0

@Lisa for this you will have to add 'class="something"' to the anchors you want and have '.something { color: #3088FF !important; }' –

4

如果您必須覆蓋現有樣式,使用!important聲明。例如,

.myStyledLink{ 
    color: #FFF !important; 
} 
+0

HI, BUT I just wanna apply this anchor text CSS only to that particular anchors, my override CSS shouldnt change actual behavior of CSS.. So, does this !important; can only be used for specific anchor tags..? –

+0

You can use a class on the anchors which you want to override the css rules. 'MyLinkText' – looq

1

確定輸出HTML中類別小部件的ID。假設id="widget-cat",然後按如下所示創建CSS規則以覆蓋該窗口小部件中的鏈接顏色,例如,

#widget-cat a:link, #widget-cat a:visited { 
    color: #FFF; 
} 

使用的!important是很不得已壓倒一切的風格真的,我建議只使用過,如果你需要覆蓋不能作出更加具體,由第三方寫CSS規則那些你無法控制的開發者。