Home  >  Article  >  Web Front-end  >  How to set hyperlink color in css

How to set hyperlink color in css

藏色散人
藏色散人Original
2021-05-14 10:50:437364browse

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.

How to set hyperlink color in css

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn