checkbox选中效果自定义大小和颜色

2021-08-17  本文已影响0人  每天进步一点点5454
image.png
image.png
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
                .pay_stylestyle input[type="checkbox"] {
            width: 20px;
            height: 20px;
            display: inline-block;
            text-align: center;
            vertical-align: middle;
            line-height: 18px;
            position: relative;
        }

        .pay_stylestyle input[type="checkbox"]::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            background: #fff;
            width: 86%;
            height: 86%;
            border: 1px solid #d9d9d9;
        }

        .pay_stylestyle input[type="checkbox"]:checked::before {
            content: "\2713";
            background-color: #fff;
            position: absolute;
            top: 0px;
            left: 0;
            width: 86%;
            height: 86%;
            border: 1px solid #3A71FF;
            color: #fff;
            font-size: 13px;
            font-weight: bold;
            background: #3A71FF;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    </style>
    

    </style>
</head>
<body>
    <div class="pay_stylestyle">
        <input type="checkbox">
    </div>
</body>
</html>
上一篇下一篇

猜你喜欢

热点阅读