伪类选择器(实现鼠标悬浮字体变色效果)

发布时间 2023-10-10 17:33:20作者: wellplayed

链接框与文本框:

实现鼠标悬浮变色效果

     a:link { /*访问之前的状态*/
            color: red;
        }
        a:hover { /*鼠标悬浮态*/
            color: aqua;
        }
        a:active { /*鼠标点击不松开的状态:激活态*/
            color: black;
        }
        a:visited { /*访问之后的状态*/
            color: darkgray;
        }

        p { /*访问之前的状态*/
            color: red;
        }
        p:hover { /*鼠标悬浮态*/
            color: white;
        }

 

input框:

        input:focus { /*input框获取焦点(鼠标点击了input框)*/
            background-color: darkblue;
        }