-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7.html
More file actions
47 lines (43 loc) · 1.18 KB
/
7.html
File metadata and controls
47 lines (43 loc) · 1.18 KB
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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>=^.^=</title>
<style>
body {
background:
linear-gradient( 45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75% ) 0 0 / 40px 40px,
linear-gradient( 45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75% ) 20px 20px / 40px 40px;
}
</style>
</head>
<body>
<svg width="0" height="0" xmlns="http://www.w3.org/2000/svg">
<filter id="outline" x="-50%" y="-50%" width="200%" height="200%">
<!-- アルファチャンネルを4px拡大し、紫色で塗りつぶし、元入力と合成する -->
<feMorphology in="SourceAlpha" operator="dilate" radius="4" />
<feColorMatrix type="matrix" values="
1 0 0 0 0.443
0 1 0 0 0.196
0 0 1 0 0.792
0 0 0 1 0"/>
<feMerge>
<feMergeNode/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</svg>
<p style="filter: url(#outline);">
SVG Filterを使うと、アルファ付き画像にも枠線を付けられます
</p>
<div>
filterなし
<img src="flying.webp" alt="" />
</div>
<div style="filter: url(#outline);">
filterあり
<img src="flying.webp" alt="" />
</div>
</body>
</html>