What to do if css a hover does not change color

藏色散人
Release: 2023-01-04 09:38:36
Original
3881 people have browsed it

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="#">//m.sbmmt.com</a>
Copy after login

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!

Related labels:
css
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!