Home  >  Article  >  Web Front-end  >  What to do if css a hover does not change color

What to do if css a hover does not change color

藏色散人
藏色散人Original
2021-01-05 10:15:063991browse

css a hover does not change color because the order of the selectors is written wrong. The solution is: first open the corresponding css file; then write the hover after link and visited and before active.

What to do if css a hover does not change color

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

Related recommendations: "css video tutorial"

What should I do if the a tag hover in css does not change color?

The reason why the a tag hover in css does not change color is because the order of the selectors is wrong. Just write hover after link and visited and before active.

hover CSS pseudo-class is suitable for situations where the user uses a pointing device to virtually point to an element (without activating it). This style will be overridden by any link-related pseudo-classes, such as :link, :visited, and :active.

In order to ensure effectiveness, the :hover rule needs to be placed after the :link and :visited rules, but before the :active rule, declare: link -:visited -:hover -:active in the LVHA order.

<style>
    a:link{
        color: red;
    }
    a:visited{
        color: pink;
    }
    a:hover{
        color: blue;
    }
    a:active{
        color: skyblue;
    }
</style>
<a href="#">http://www.php.cn</a>

The above is the detailed content of What to do if css a hover does not change color. 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