Home >Web Front-end >HTML Tutorial >Restore the color of the link text after clicking the link_html/css_WEB-ITnose
When visiting the page, the initial color of the link is "black". When the mouse hovers over the link, the color changes. When the link is clicked, the color returns to black? ? ?
css style:
a:link {color: #666666;text-decoration: none;}
a:visited {text-decoration: none;color: #666666;}
a:hover {text-decoration: underline;color: #000000;}
a:active {text-decoration: none;color: #666666;}
Links in the page:
< ;li>Car insurance homepage
a:link {color: #666666;text-decoration: none;}
a:hover {text-decoration: underline;color: #000000;}
Defining these two pseudo-classes can achieve the goal.
The following two can be ignored
a:visited {text-decoration: none;color: #666666;}
a:active {text-decoration: none;color : #666666;}
If you don’t remove the two styles below, is there any other way? (These css styles are placed in a separate public css file and cannot be modified easily)
a:visited {text-decoration: none;color: #666666;}
a:active {text-decoration: none;color: #666666;}
If you don’t remove the two styles below, is there any other way? (These css styles are placed in a separate public css file and cannot be modified easily)
a:visited {text-decoration: none;color: #666666;}
a:active {text-decoration: none;color: #666666;}
If you don’t remove it, the visited links will remain gray until you clear the cache.
Can't I add styles individually to a specific element on a page to override the style of the css file? ? ?
If you don’t remove the two styles below, is there any other way? (These css styles are placed in a separate public css file and cannot be modified easily)
a:visited {text-decoration: none;color: #666666;}
a:active {text-decoration: none;color: #666666;}
If this file cannot be moved, then you can only write another file and define a class or pseudo-class that is closer to your target connection than this file to override the style of this file. For example, add id=a1 to your a tag, and define a#a1{..} in the new css file, so that the effect can be achieved.
Reminder lz: If it is a team project and you are not the designer, it is recommended that you follow what others have set and do not add any unnecessary extravagance.