如何在HTML中使用HTML转换颜色并使用CSS删除下划线?
You want to look at the :hover pseudoselector , the color property , and the text-decoration property.
a:hover { color: red; text-decoration: none; }
To assure your hyperlink is styled as you want (and does not conflict with other style rules), use !important
:
a:hover { color: red !important; text-decoration: none !important; }
Also in addition to stragers answer, make sure to declare the pseudo classes in the LoVe HAte way. You have to declare :link first, then :visited, then :hover and then :active. Otherwise some browsers may not apply the pseudo classes.
a:link{ /*this only apllies to named anchors*/ } a:visited{ /*possible styles for visited links*/ } a:hover{ /*when mouse hovers over a-tag*/ text-decoration:none; color:red; } a:active{ /*possible styles on active (when a-tag is clicked)*/ }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.