css3 简单的立方体
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
61
62
63
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>css3 简单的立方体</title>
<style type="text/css">
.box {
width: 100px;
height: 100px;
background-color: tomato;
opacity: 0.8;
border-radius: 3px;
box-shadow: 1px 1px 2px #000000;
/*阴影x向位移,阴影y向位移,阴影边缘模糊,阴影颜色*/
text-shadow: 1px 1px 2px #ffffff;
}

.box {
/*位移,x向位移,y向位移*/
transform: translate(100px, 50px);
/*缩放,x向缩放,y向缩放*/
transform: scale(1.5, 0.5);
/* 旋转,角度单位deg */
transform: rotate(45deg);
/* 变形,角度单位deg */
transform: skew(20deg);
}

.cube>.top {
width: 240px;
height: 60px;
background-color: #dddddd;
transform: skew(-45deg, 0) translate(30px, 0);
}

.cube>.center {
width: 240px;
height: 240px;
background-color: #aaaaaa;
display: inline-block;
}

.cube>.right {
width: 60px;
height: 240px;
background-color: #888888;
display: inline-block;
transform: skew(0, -45deg) translate(0, -30px);
}
</style>
</head>

<body>
<!-- <div class="box">hello</div> -->
<div class="cube">
<div class="top"></div>
<!-- 换行有空隙 -->
<div class="center"></div><div class="right"></div>
</div>
</body>

</html>

评论