Home  >  Article  >  Web Front-end  >  How to prevent links from changing color in html

How to prevent links from changing color in html

青灯夜游
青灯夜游Original
2021-05-17 15:15:265744browse

htmlMethods to keep links from changing colors: Use ":link", ":visited", ":hover" and ":active" pseudo-classes in order to set unvisited links and visited links respectively. , when the mouse is hovering over a link, the link colors of the four link states of the selected link can be the same.

How to prevent links from changing color in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

You can set the link color in different situations to the same one by setting the pseudo-class of the link style, so that the link does not change color. You can use several pseudo-classes such as :link, :visited, :hover, :active, etc. to set link styles.

Pseudo-class to set the link color so that the link does not change color:

a:link {color: #0000FF}     /* 未访问的链接 */
a:visited {color: #0000FF}  /* 已访问的链接 */
a:hover {color: #0000FF}    /* 当有鼠标悬停在链接上 */
a:active {color: #0000FF}   /* 被选择的链接 */

Description:

  • :link pseudo-class adds special styles to unvisited links.

  • : The visited selector is used to select links that have been visited.

  • :hover selector is used to select the element on which the mouse pointer is floating.

  • :active selector is used to select active links.

(Learning video sharing: css video tutorial, "html video tutorial")

The above is the detailed content of How to prevent links from changing color in html. 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