Home > Web Front-end > HTML Tutorial > Help: CSS hyperlink, if you select it and click elsewhere, the selected selection style will disappear. _html/css_WEB-ITnose

Help: CSS hyperlink, if you select it and click elsewhere, the selected selection style will disappear. _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:16:52
Original
1229 people have browsed it


CSS settings:

#page a:hover {text-decoration:none; color:red;}
#page a:active {text-decoration:underline; color:red ;}

After selecting, click on other blank areas, and the set a:active style will disappear. This style should be retained until other links of the same level are clicked...


Reply to discussion (solution)

Pseudo-class, compatibility is not very good. You can use js to add a class after clicking.

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


This is only eligible when it is activated

CSS code?1234a:link {color: #FF0000} /* Not visited Link */a:visited {color: #00FF00} /* Visited link */a:hover {color: #FF00FF} /* When the mouse is hovering over the link */a:active {color: #0000FF } /* The selected link */

This is only activated...

Doesn’t this count as activated when the link is clicked?

This should be the moment you click, before the mouse is released. . In the process of operation. . . .

This should be the moment you click, before the mouse is released. . In the process of operation. . . .

Okay, then may I ask, how to change it?

Can’t changing it to a:visited achieve the effect you want?
Or, if you want more effects, you can use them in combination
For example, a:visited:hover, which represents the links that have been visited, and the situation when the mouse is hovering.
Try your own combination according to your own situation.

However, if you operate too many times, it is best to clear the cache, because the browser will remember the websites you visited before, and after refreshing, it will still show that you have visited it.

Can’t changing it to a:visited achieve the effect you want?
Or, if you want more effects, you can use them in combination
For example, a:visited:hover, which represents the links that have been visited, and the situation when the mouse is hovering.
Try your own combination according to your own situation.

1

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template