<div class="container">
<div></div>
<div></div>
<div></div>
</div>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
body {
width: 100vw;
height: 100vh;
display: grid;
place-items: center;
}
.container {
position: relative;
width: 75vw;
height: 75vh;
overflow: hidden;
background-color: #ff9a00;
border: 1px solid #777;
}
.container div {
position: absolute;
width: 75vw;
height: 75vh;
transform-origin: bottom left;
}
.container div:nth-of-type(1) {
background-color: #ff3800;
/* skew 为倾斜角度 */
transform: skew(-25deg) translateX(-25vw);
}
.container div:nth-of-type(2) {
background-color: #7800ff;
/* skew 为倾斜角度 */
transform: skew(-25deg) translateX(-45vw);
}
.container div:nth-of-type(3) {
background-color: #ff009c;
/* skew 为倾斜角度 */
transform: skew(-25deg) translateX(-65vw);
}
JS
格式化