常用页面效果 --- 基础效果

1. CSS --- 鼠标点击后背景变色

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .filter{
            margin: 80px 40px;
            display: flex;
            width: 990px;
            padding: 50px 30px;
        }
        .filter a{
            padding: 10px 20px;
            margin-right: 20px;
            background: #f5f5f5;
            color: #666;
            text-decoration: none;
        }
        a {
            text-decoration: none;
            color: #666;
        }
        a:hover {
            color:#DD302D;
            text-decoration: none;
        }

        /* CSS 控制鼠标点击后背景变色 */
        .filter a:active,
        .filter a:focus {
            background: #05943c;
            color: #fff;
        }

    </style>
</head>
<body>
<div class="box">
    <div class="filter">
        <a href="javascript:">0-100元</a>
        <a href="#">100-300元</a>
        <a href="#">300元以上</a>
        <a href="#">全部区间</a>
    </div>
</div>


<script>

</script>
</body>
</html>
posted @ 2024-05-22 11:04  河图s  阅读(11)  评论(0)    收藏  举报