嘗試這樣的事情:
a { color: #0060B6; text-decoration: none; } a:hover { color:#00A0C6; text-decoration:none; cursor:pointer; }
如果text-decoration
不起作用,請(qǐng)將其變更為:
text-decoration: none !important;
!important
規(guī)則會(huì)覆寫 text-decoration
屬性的所有其他樣式。您可以在此處閱讀更多相關(guān)資訊。
繼承值:
a { color: inherit; }
...將導(dǎo)致元素呈現(xiàn)其父級(jí)的顏色(我認(rèn)為這就是您正在尋找的)。
現(xiàn)場(chǎng)示範(fàn)如下:
a {
color: inherit;
}
<p>The default color of the html element is black. The default colour of the body and of a paragraph is inherited. This
<a >link</a> would normally take on the default link or visited color, but has been styled to inherit the color from the paragraph.</p>