Skip to content

Commit 4cc8621

Browse files
committed
doc: add autofocus,autoplay attribute document.
1 parent ddf1aba commit 4cc8621

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

docs/attribute/autofocus.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ HTML autofocus 属性
5656

5757
| 标签 Element | ![chrome][1] | ![edge][2] | ![firefox][3] | ![safari][4] | ![opera][5] |
5858
| ------- | --- | --- | --- | --- | --- |
59-
| form | 5.0 | 10.0 | 4.0 | 5.0 | 9.6 |
60-
| input | 5.0 | 10.0 | 4.0 | 5.0 | 9.6 |
61-
| textarea | Yes | 10.0 | 4.0 | Yes | Yes |
59+
| [form](../tags/form.md) | 5.0 | 10.0 | 4.0 | 5.0 | 9.6 |
60+
| [input](../tags/input.md) | 5.0 | 10.0 | 4.0 | 5.0 | 9.6 |
61+
| [textarea](../tags/textarea.md) | Yes | 10.0 | 4.0 | Yes | Yes |
6262

6363

6464
[1]: ../assets/chrome.svg

docs/attribute/autoplay.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,59 @@
1-
autoplay.md
1+
HTML autoplay 属性
22
===
33

4-
欢迎您编辑 <a target="__blank" href="https://github.com/jaywcjlove/html-tutorial/blob/main/docs/attribute/autoplay.md">docs/attribute/autoplay.md</a> 文件,共建 HTML Tutorial 文档。
4+
## 定义和用法
5+
6+
`autoplay` 属性是一个布尔属性。
7+
8+
当存在时,音频/视频将立即自动开始播放而不会停止。
9+
10+
## 适用于
11+
12+
`autoplay` 属性可用于以下元素:
13+
14+
| 标签 Element | 属性 Attribute |
15+
| ----- | ----- |
16+
| [\<audio>](../tags/audio.md) | [autoplay](../tags/audio_autoplay.md) |
17+
| [\<video>](../tags/video.md) | [autoplay](../tags/video_autoplay.md) |
18+
19+
## 示例
20+
21+
将自动开始播放的音频文件:
22+
23+
```html idoc:preview:iframe
24+
<audio controls autoplay>
25+
<source src="horse.ogg" type="audio/ogg">
26+
<source src="horse.mp3" type="audio/mpeg">
27+
您的浏览器不支持音频元素。
28+
</audio>
29+
```
30+
31+
将自动开始播放的视频:
32+
33+
```html idoc:preview:iframe
34+
<video width="320" autoplay>
35+
<source
36+
type="video/mp4"
37+
src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4">
38+
<source
39+
type="video/webm"
40+
src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm">
41+
您的浏览器不支持 video 标签。
42+
</video>
43+
```
44+
45+
## 浏览器支持
46+
47+
`autoplay` 属性对每个元素都有以下浏览器支持:
48+
49+
| 标签 Element | ![chrome][1] | ![edge][2] | ![firefox][3] | ![safari][4] | ![opera][5] |
50+
| ------- | --- | --- | --- | --- | --- |
51+
| [audio](../tags/audio.md) | 4.0 | 9.0 | 3.5 | 4.0 | 10.5 |
52+
| [video](../tags/video.md) | 4.0 | 9.0 | 3.5 | 4.0 | 10.5 |
53+
54+
55+
[1]: ../assets/chrome.svg
56+
[2]: ../assets/edge.svg
57+
[3]: ../assets/firefox.svg
58+
[4]: ../assets/safari.svg
59+
[5]: ../assets/opera.svg

0 commit comments

Comments
 (0)