-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
54 lines (45 loc) · 2.34 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
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/example.jpg" type="image/jpg">
<title>Img Support</title>
<script src="/img_support.js"></script>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<main class="container">
<div class="example">
<div class="img_container"></div>
<p class="text"></p>
</div>
<div class="copy">
<p><a href="https://github.com/MoisesKMS/img_support">Utility</a> to determine if a browser supports WEBP and AVIF formats by <a href="https://github.com/MoisesKMS">MoisesKMS</a></p>
</div>
<div class="use">
<h2 class="use__title">How to use</h2>
<div class="use__steps">
<p class="step">1. Add the <a href="https://raw.githubusercontent.com/MoisesKMS/img_support/main/img_support.js">img_support.js</a> script before your cloasing 'head' tag and css styles.</p>
<p class="step">2. In your css code, add 2 classes <code>.webp</code> and <code>.avif</code> before your main image container class</p>
<p class="separatos">Example:</p>
<pre class="pre"><code class="code">
.img_container {
background-image: url(/img/example.jpg);
}
.webp .img_container {
background-image: url(/img/example.webp);
}
.avif .img_container {
background-image: url(/img/example.avif);
}
</code></pre>
<p class="a_text">This will make the jpg, png, etc. formats load in case the browser doesn't support avif or webp.</p>
<p class="a_text">If the browser supports WEBP but not AVIF, it will only download de WEBP image</p>
<p class="a_text">If the browser supports AVIF, it will only download de AVIF image</p>
<p class="warning_text">WARNING: the order is important, if the browser supports avif and you add the .avif class before the .webp class, the browser will use .webp instead of .avif</p>
</div>
</div>
</main>
</body>
</html>