forked from jgthms/html-reference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
242 lines (222 loc) · 9.75 KB
/
Copy pathindex.html
File metadata and controls
242 lines (222 loc) · 9.75 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
---
layout: single
elementName: source
---
<section id="source" class="element">
<header class="element-header">
<nav class="element-links">
<span>
Self-closing:
<strong>
Yes
</strong>
</span>
<a class="element-links-direct" href="{{site.url}}/element/source/" data-element-name="source" data-tooltip="Single page for this element">Permalink</a>
<a class="element-share" data-tooltip="Share on Twitter or Facebook" data-element-name="source">Share</a>
<a target="_blank" href="https://developer.mozilla.org/en/docs/Web/HTML/Element/source" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a>
</nav>
<h2 class="element-name">
<a href="#source">
<span>#</span>
source
</a>
</h2>
<div class="element-description">
<p>Defines a <strong>source</strong> for an <code><audio></code>, <code><video></code>, or <code><picture></code> element.</p>
</div>
</header>
<div id="source-example-0" class="example">
<p class="example-label">
<strong>Example:</strong>
<a class="example-clipboard" data-tooltip="Click to copy code" data-clipboard-target="#source-example-0-code">Copy</a>
</p>
<article class="example-preview">
<div class="example-output"><picture>
<source
media="(min-width: 800px)"
srcset="/images/sunset-360.jpg 360w,
/images/sunset-720.jpg 720w,
/images/sunset-1440.jpg 1440w"
sizes="33.3vw">
<source
srcset="/images/sunset-720.jpg 2x,
/images/sunset-360.jpg 1x">
<img src="/images/sunset.jpg" alt="Picture of a Ha Long Bay sunset">
</picture></div>
<div id="source-example-0-code" class="example-code">{% highlight html %}<picture>
<source
media="(min-width: 800px)"
srcset="/images/sunset-360.jpg 360w,
/images/sunset-720.jpg 720w,
/images/sunset-1440.jpg 1440w"
sizes="33.3vw">
<source
srcset="/images/sunset-720.jpg 2x,
/images/sunset-360.jpg 1x">
<img src="/images/sunset.jpg" alt="Picture of a Ha Long Bay sunset">
</picture>{% endhighlight %}</div>
</article>
</div>
<article id="source-src" class="attribute">
<header class="attribute-header">
<h3 class="attribute-name">
<code class="tag" data-tooltip="Click to copy" data-clipboard-text="src">
src
</code>
</h3>
<div class="attribute-description">
<p>The URL where the media is hosted.</p>
</div>
</header>
<div class="attribute-values">
<article id="source-src-imagestiramisujpg" class="value">
<header class="value-header">
<h4 class="value-name">
<code class="tag" data-tooltip="Click to copy src="/images/tiramisu.jpg"" data-clipboard-text="src="/images/tiramisu.jpg"">
"/images/tiramisu.jpg"
</code>
</h4>
<div class="value-description">
<p>You can use a <strong>relative</strong> URL.</p>
</div>
</header>
<aside class="value-preview">
<div class="value-output"><source src="/images/tiramisu.jpg"></source></div>
</aside>
</article>
<article id="source-src-siteurlimagestrafficjpg" class="value">
<header class="value-header">
<h4 class="value-name">
<code class="tag" data-tooltip="Click to copy src="{{site.url}}/images/traffic.jpg"" data-clipboard-text="src="{{site.url}}/images/traffic.jpg"">
"{{site.url}}/images/traffic.jpg"
</code>
</h4>
<div class="value-description">
<p>You can use an <strong>absolute</strong> URL.</p>
</div>
</header>
<aside class="value-preview">
<div class="value-output"><source src="{{site.url}}/images/traffic.jpg"></source></div>
</aside>
</article>
</div>
</article>
<article id="source-srcset" class="attribute">
<header class="attribute-header">
<h3 class="attribute-name">
<code class="tag" data-tooltip="Click to copy" data-clipboard-text="srcset">
srcset
</code>
</h3>
<div class="attribute-description">
<p>Defines a list of <em>different</em> <strong>sources</strong> for the <em>same</em> media. The browser will choose the best one to use.</p>
</div>
</header>
<div class="attribute-values">
<article id="source-srcset-imagessunset-360jpg-360w-imagessunset-720jpg-720w-imagessunset-1440jpg-1440w" class="value">
<header class="value-header">
<h4 class="value-name">
<code class="tag" data-tooltip="Click to copy srcset="/images/sunset-360.jpg 360w, /images/sunset-720.jpg 720w, /images/sunset-1440.jpg 1440w"" data-clipboard-text="srcset="/images/sunset-360.jpg 360w, /images/sunset-720.jpg 720w, /images/sunset-1440.jpg 1440w"">
"/images/sunset-360.jpg 360w,<br> /images/sunset-720.jpg 720w,<br> /images/sunset-1440.jpg 1440w"
</code>
</h4>
<div class="value-description">
<p>You can use a <strong>width descriptor</strong> like <code>360w</code>. This value is divided by one of the source sizes (defined in the <code>sizes</code> attribute) to obtain the <strong>pixel density</strong>.</p>
<p>@html</p>
</div>
</header>
<aside class="value-preview">
<div class="value-output"><source srcset="/images/sunset-360.jpg 360w, /images/sunset-720.jpg 720w, /images/sunset-1440.jpg 1440w"></source></div>
</aside>
</article>
</div>
</article>
<article id="source-sizes" class="attribute">
<header class="attribute-header">
<h3 class="attribute-name">
<code class="tag" data-tooltip="Click to copy" data-clipboard-text="sizes">
sizes
</code>
</h3>
<div class="attribute-description">
<p>Defines a list of different source <strong>sizes</strong>. You can combine each of them with a <strong>media query</strong>.</p>
</div>
</header>
<div class="attribute-values">
<article id="source-sizes-min-width-800px-1440px-720px" class="value">
<header class="value-header">
<h4 class="value-name">
<code class="tag" data-tooltip="Click to copy sizes="(min-width: 800px) 1440px, 720px"" data-clipboard-text="sizes="(min-width: 800px) 1440px, 720px"">
"(min-width: 800px) 1440px, 720px"
</code>
</h4>
<div class="value-description">
<p>The browser will use the <code>1440px</code> image (defined in <code>srcset</code>) if the viewport is larger than 800px.<br>It will use the <code>720px</code> otherwise.</p>
<p>@html</p>
</div>
</header>
<aside class="value-preview">
<div class="value-output"><source sizes="(min-width: 800px) 1440px, 720px"></source></div>
</aside>
</article>
</div>
</article>
<article id="source-type" class="attribute">
<header class="attribute-header">
<h3 class="attribute-name">
<code class="tag" data-tooltip="Click to copy" data-clipboard-text="type">
type
</code>
</h3>
<div class="attribute-description">
<p>Defines the <a href="http://www.iana.org/assignments/media-types/media-types.xhtml">MIME type</a> of the source.</p>
</div>
</header>
<div class="attribute-values">
<article id="source-type-imagejpg" class="value">
<header class="value-header">
<h4 class="value-name">
<code class="tag" data-tooltip="Click to copy type="image/jpg"" data-clipboard-text="type="image/jpg"">
"image/jpg"
</code>
</h4>
<div class="value-description">
<p>You can only use audio, video, or picture MIME types.</p>
</div>
</header>
<aside class="value-preview">
<div class="value-output"><source type="image/jpg"></source></div>
</aside>
</article>
</div>
</article>
<article id="source-media" class="attribute">
<header class="attribute-header">
<h3 class="attribute-name">
<code class="tag" data-tooltip="Click to copy" data-clipboard-text="media">
media
</code>
</h3>
<div class="attribute-description">
<p>Defines a media query for a <code><picture></code> source.</p>
</div>
</header>
<div class="attribute-values">
<article id="source-media-min-width-800px" class="value">
<header class="value-header">
<h4 class="value-name">
<code class="tag" data-tooltip="Click to copy media="(min-width: 800px)"" data-clipboard-text="media="(min-width: 800px)"">
"(min-width: 800px)"
</code>
</h4>
<div class="value-description">
<p>The media will only be used on viewports larger than 800px.</p>
</div>
</header>
<aside class="value-preview">
<div class="value-output"><source media="(min-width: 800px)"></source></div>
</aside>
</article>
</div>
</article>
</section>