2025年css伪类选择器用法(css伪类选择器hover)

css伪类选择器用法(css伪类选择器hover)hover nbsp nbsp 当鼠标悬浮在元素上方时 向元素添加样式 实例 lt DOCTYPE html gt lt html gt nbsp nbsp nbsp lt head gt nbsp nbsp nbsp nbsp amp

大家好,我是讯享网,很高兴认识大家。



hover   当鼠标悬浮在元素上方时,向元素添加样式。

实例


讯享网

<!DOCTYPE html>
<html>
    <head>
        <meta charset=“UTF-8”>
        <title></title>
        <style type=“text/css”>
            .div01{
                width: 100px;
                height: 100px;
                background-color: #f00;
            }
            #div01{     /100/
                background-color: #000;
            }
            .div01:hover{    /10+10/
                background-color: #ff0;
            }
        </style>
    </head>
    <body>
        <!–:hover      叫伪类选择器
            当你的鼠标放上去的时候,会变化成的样子
            权值   10
        –>
        
        
        <div class=“div01” id=“div01”>
            
        </div>
    </body>
</html>

 

小讯
上一篇 2025-05-12 08:57
下一篇 2025-04-29 22:56

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/149333.html