Home > Article > Web Front-end > How to set hyperlink color in css
How to set the color of hyperlinks in css: 1. Set the color of unvisited links through "a:link{color:#000000;}"; 2. Through "a:visited {color:#00FF00;}" ” Set the color of visited links and more.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer
css can use the following pseudo-classes to set hyperlinks:
a:link: It is an unvisited style. You can add a lot of things to it, such as removing underlines, changing colors, etc.;
a:visited: Yes After the style has been clicked, you can also add many elements to it, and you can remove the underline, change the color, zoom in and other functions;
a:hover: This is the mouse hover style. There will be examples of this later. , let’s get to know it first. You can set the color to change when the mouse is parked at the position of the hyperlink;
a:active: This is said to be an activated style. To put it simply, you can click the mouse When you go up, the style will appear instantly, which is found on many websites;
Use the following style to modify the hyperlink color:
a:link{color:#000000;} /* 未访问链接*/ a:visited {color:#00FF00;} /* 已访问链接 */ a:hover {color:#FF00FF;} /* 鼠标移动到链接上 */ a:active {color:#0000FF;} /* 鼠标点击时 */
Example:
<html> <head> <style type="text/css"> a:link {color:#000000;} /* 未访问链接*/ a:visited {color:#00FF00;} /* 已访问链接 */ a:hover {color:#FF00FF;} /* 鼠标移动到链接上 */ a:active {color:#0000FF;} /* 鼠标点击时 */ </style> <title>test css</title> </head> <body> <a href="#">HTML中文网</a> </body>
Recommended learning: "css video tutorial"
The above is the detailed content of How to set hyperlink color in css. For more information, please follow other related articles on the PHP Chinese website!