Home >Web Front-end >CSS Tutorial >How to change hyperlink color in css

How to change hyperlink color in css

王林
王林Original
2021-03-09 14:52:284507browse

How to change the color of a hyperlink in css: You can use pseudo classes and combine it with the color attribute, such as [a:link{color:#000000}], which means setting the color of the hyperlink when it is not visited.

How to change hyperlink color in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

In css we can use the following pseudo-classes to set hyperlinks:

  • a:link: It is an unvisited style, you can add many in it Things, such as removing underlines, changing colors and other functions can be implemented here;

  • a:visited: It is the style after being clicked. You can also add many elements to it. Remove underline, change color, zoom in and other functions;

  • a:hover: This is the style of mouse hovering. There will be examples of this later. Let’s get to know it first. You can set the color to change when you stop at the hyperlink position;

  • a:active: This is said to be an activated style. To put it simply, it means that when you click the mouse on it, The style that appears instantly can be 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;}  /* 鼠标点击时 */

(Learning video sharing :css video tutorial

The code example is as follows:

How to change hyperlink color in css

Related recommendations:CSS tutorial

The above is the detailed content of How to change 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