CSS3 3D盒子

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        body{
            background: #2c3e50;
            width: 100vw;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .btn{
            color: white;
            text-decoration: none;
            width: 200px;
            height: 40px;
            background: #e74c3c;
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
            transform: scaleX(25deg) rotate(-15deg);
            letter-spacing: .5em;
        }
        .btn::before{
            content: '';
            width: 10px;
            height: 100%;
            background: black;
            position: absolute;
            left: -10px;
            transform: skewY(-45deg) translate(0,5px);
        }
        .btn::after{
            content: '';
            width: 100%;
            height: 10px;
            background: black;
            position: absolute;
            bottom: -10px;
            transform: skewX(-45deg) translate(-5px,0);
        }
    </style>
</head>
<body>
    <a href="" class="btn">次元猫</a>
</body>
</html>

 

点赞

发表评论