根据HTML和CSS相关知识,使鼠标经过 ul的li变色

<!DOCTYPE html>
<html lang=”zh”>
<head>
    <meta charset=”UTF-8″>
    <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
    <meta http-equiv=”X-UA-Compatible” content=”ie=edge”>
    <title>sdadad</title>
    <style type=”text/css”>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        li {
            list-style: none
        }
        .fassf {
            margin: 1.875rem auto;
            height: 300px;
            width: 170px;
            background-color: #0000FF;
            color: #fff;
        }
        li {
            width: 8.75rem;
            height: 40px;
            line-height: 40px;
            font-size: 16px;
            background-color: tomato;
            padding-left: 10px;
            margin-bottom: 3px;
            transition: all .3s;
            margin-left: 10px;
        /*     cursor: pointer; */
        }    
        li:hover {
            background-color: greenyellow;
            color: #0000FF;
            margin-left: 13px;
            cursor: pointer;
        }
        a {
            text-decoration: none;
            color: #fff;
        }
        li:hover a{
            color: #0000FF;
        }
    </style>
</head>
<body>
    <div class=”fassf”>
        <ul>
            <li><a href=”#”>1</a>&nbsp;<a href=”#”>3</a></li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
    </div>
</body>
</html>

不要过度关注属性名,hhhh

li:hover a 的意思是当鼠标经过li时,a会发生的事件

标签