Link in CSS refers to a CSS link. Different links can have different styles, and the link style can use any CSS attribute. There are 4 link states, namely: 1. "a:link" ;2. "a:visited"; 3. "a:hover"; 4. "a:active".
The operating environment of this tutorial: Windows 10 system, CSS3, this article is applicable to all brands of computers.
CSS Link
Different links can have different styles.
Link style
The link style can use any CSS properties (such as color, font, background, etc.).
Special links can have different styles, depending on their status.
The four link statuses are:
a:link - normal, unvisited link
a:visited - link that the user has visited
a:hover - when the user mouses over the link
a:active - the moment when the link is clicked
Example
a:link {color:#000000;} /* 未访问链接*/ a:visited {color:#00FF00;} /* 已访问链接 */ a:hover {color:#FF00FF;} /* 鼠标移动到链接上 */ a:active {color:#0000FF;} /* 鼠标点击时 */
When set to several links There are also some order rules for status styles:
a:hover must follow a:link and a:visited
a:active must follow a:hover
Common link styles
Based on the example of the color change of the link above, see what state it is in.
Let’s move on to link styling through some other common ways:
Text-decoration
The text-decoration attribute is mainly used to remove underlines from links:
Example
a:link {text-decoration:none;} a:visited {text-decoration:none;} a:hover {text-decoration:underline;} a:active {text-decoration:underline;}
Background Color
The background color attribute specifies the link background color:
Example
a:link {background-color:#B2FF99;} a:visited {background-color:#FFFF85;} a:hover {background-color:#FF704D;} a:active {background-color:#FF704D;}
The above is the detailed content of What does link mean in CSS?. For more information, please follow other related articles on the PHP Chinese website!