hooyantsing's Blog

P174_23_快速制作3D立体按钮

字数统计: 203阅读时长: 1 min
2020/04/22

P174 23 快速制作3D立体按钮

实战案例

介绍:练习倾斜skew旋转rotate

效果:

d80ca0614eefbd72b583cc207a30d549.png

源码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        body {
            height: 100vh;
            width: 100vw;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #2c3e50;
        }
        .btn{
            height: 40px;
            width: 200px;
            background: #e74c3c;
            display: flex;
            justify-content: center;
            align-items: center;
            text-decoration: none;
            color: white;
            font-size: .8em;
            position: relative;
            transform: skewX(25deg) rotate(-15deg);
            letter-spacing: .5em;
            text-transform: uppercase;
            font-weight: bold;
        }
        .btn::before{
            content: '';
            width: 10px;
            height: 100%;
            position: absolute;
            left: -10px;
            background: black;
            transform: skewY(-45deg) translateY(5px);
        }
        .btn::after{
            content: '';
            width: 100%;
            height: 10px;
            position: absolute;
            bottom: -10px;
            background: black;
            transform: skewX(-45deg) translateX(-5px);
        }
    </style>
</head>
<body>
<a href="" class="btn">houdunren</a>
</body>
</html>
CATALOG