forked from ahmadnassri/css-diagonal-separators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.css
47 lines (41 loc) · 899 Bytes
/
style.css
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
:root {
--width: 300px;
--height: 100px;
--top-color: #f44336;
--bottom-color: #2196F3;
--vertical-angle: 108.5deg;
--horizontal-angle: 18.5deg;
}
.separator {
width: var(--width);
height: var(--height);
overflow: hidden;
}
.separator::before {
display: block;
content: '';
width: 100%;
height: 100%;
background-color: var(--top-color);
transform: skewY(calc(-1 * var(--horizontal-angle)));
transform-origin: bottom left;
}
.separator::after {
display: block;
content: '';
width: 100%;
height: 100%;
background-color: var(--bottom-color);
transform: skewY(calc(-1 * var(--horizontal-angle)));
transform-origin: bottom left;
}
.vertical .separator::before,
.vertical .separator::after {
transform: skewY(var(--vertical-angle));
}
.separator.reverse {
transform: rotateY(180deg);
}
.vertical .separator.reverse {
transform: rotateX(180deg);
}