CSS伪类实现加号

<!DOCTYPE html>
<html lang="en">

<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>Document</title>
</head>

<body>
    <div class="add"></div>
    <style>
        .add {
            border: 1px solid;
            width: 100px;
            height: 100px;
            color: #ccc;
            transition: color .25s;
            position: relative;
        }


        .add::before {
            content: '';
            position: absolute;
            left: 50%;
            top: 50%;
            width: 80px;
            margin-left: -40px;
            margin-top: -5px;
            border-top: 10px solid;
        }


        .add::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 50%;
            height: 80px;
            margin-left: -5px;
            margin-top: -40px;
            border-left: 10px solid;
        }


        .add:hover {
            color: blue;
        }
    </style>

</body>

</html>
发布了452 篇原创文章 · 获赞 83 · 访问量 27万+

猜你喜欢

转载自blog.csdn.net/caseywei/article/details/103084585