-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
43 lines (38 loc) · 2.65 KB
/
index.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CSS Paint API: Polygon Border</title>
<meta name="description" content="Add border to complex shapes using the CSS Paint API from the Houdini project">
<meta name="author" content="Temani Afif">
<meta property="og:title" content="CSS Paint API: Polygon Border">
<meta property="og:type" content="website">
<meta property="og:url" content="https://afif13.github.io/CSS-polygon-border/">
<meta property="og:description" content="Add border to complex shapes using the CSS Paint API from the Houdini project">
<meta property="og:image" content="https://css-tricks.com/wp-content/uploads/2021/09/header-polygon-border.png">
<link rel="stylesheet" href="src/style.css">
</head>
<body>
<h1>CSS Paint API: Polygon Border</h1>
<hr>
<div class="box" style="--path:50% 0,100% 100%,0 100%;--border:5px;background:red;"> </div>
<div class="box" style="--path:50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%;--border:3px;background:repeating-conic-gradient(gold 0 36deg,purple 0 72deg)"> </div>
<div class="box" style="--path:50% 0%, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0% 60%, 10% 20%;--border:10px;background:conic-gradient(blue,purple,orange,green,blue)"> </div>
<div class="box" style="--path:50% 0%, 100% 30%, 50% 100%, 0% 30%;background:linear-gradient(45deg,red 50%,blue 0)"> </div>
<div class="box" style="--path:0% 15%, 15% 15%, 15% 0%, 85% 0%, 85% 15%, 100% 15%, 100% 85%, 85% 85%, 85% 100%, 15% 100%, 15% 85%, 0% 85%;background:linear-gradient(#000 40%,#0000 0 60%,grey 0)"> </div>
<hr>
<div class="box" style="--path:50% 0,100% 100%,0 100%;--border:5px;--dash:10,3;background:red;"> </div>
<div class="box" style="--path:50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%;--border:4px;background:purple;--dash:10,30"> </div>
<div class="box" style="--path:50% 0%, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0% 60%, 10% 20%;--border:10px;background:conic-gradient(blue,purple,orange,green,blue);--dash:74,19"> </div>
<div class="box" style="--path:50% 0%, 100% 30%, 50% 100%, 0% 30%;background:linear-gradient(45deg,red 50%,blue 0);--dash:10,5,15,10"> </div>
<div class="box" style="--path:0% 15%, 15% 15%, 15% 0%, 85% 0%, 85% 15%, 100% 15%, 100% 85%, 85% 85%, 85% 100%, 15% 100%, 15% 85%, 0% 85%;background:linear-gradient(#000 40%,#0000 0 60%,grey 0);--dash:5,15"> </div>
<script>
if(CSS.paintWorklet) {
CSS.paintWorklet.addModule('src/polygon-border.js');
} else {
console.log("Your browser doesn't support the Paint API :(");
}
</script>
</body>
</html>