This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
markup-image.html
67 lines (62 loc) · 1.9 KB
/
markup-image.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
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Icon Fonts</title>
<link rel="stylesheet" href="afontgarde.css">
<style>
body {
font-family: sans-serif;
max-width: 37.5em;
margin: 0 auto;
}
@font-face {
font-family: icomoon;
src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('fonts/icomoon.woff') format('woff'),
url('fonts/icomoon.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/***************************
* Fallback Bitmap
***************************/
.icon-fallback-img .icon-hamburger {
width: 1em;
height: 1em;
/* Note: BB5 doesn’t support background-images on pseudo-elements */
background: url("fonts/png/hamburger.png") no-repeat;
}
/* A-Grade */
.supports-fontface .icon-fallback-img .icon-hamburger:before {
font-family: icomoon;
content: "\e601";
}
</style>
</head>
<body>
<h3>Fallback to Image</h3>
<p>Fixed colors, must know the size of the glyph, requires `background-size` to resize.</p>
<span class="icon-fallback-img">
<span class="icon icon-hamburger" aria-hidden="true"></span>
<span class="text">Menu</span>
</span>
<h4>HTML</h4>
<pre><code>
<span class="icon-fallback-img">
<span class="icon icon-hamburger" aria-hidden="true"></span>
<span class="text">Menu</span>
</span>
</code></pre>
<h3>Failed experiments:</h3>
<ul>
<li>In an attempt to remove reliance on :before/:after, we could just put the icon character in the <code><span class="icon"></code> content. But in order to replace the content with a fallback glyph we need it in CSS.</li>
</ul>
<script src="lib/modernizr.fontface-generatedcontent.js"></script>
<script src="afontgarde.js"></script>
<script>
AFontGarde( 'icomoon', '\uE600\uE601\uE602\uE605' );
</script>
</body>
</html>