Blogger Information
Blog 70
fans 1
comment 0
visits 53090
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
创建html文档-元素-多媒体练习
葡萄枝子
Original
563 people have browsed it

创建html文档-元素-多媒体练习

1. 创建html5结构

  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. </head>
  5. <body>
  6. </body>
  7. </html>

2. head中常用标签

  1. <!-- 设置字符集 -->
  2. <meta charset="UTF-8">
  3. <!-- http-equiv,浏览器行为 -->
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
  5. <!-- 视口属性 -->
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <!-- 标题和描述 -->
  8. <title>Document</title>
  9. <meta name="description" content="">
  10. <!-- link,两个文档的连接关系 -->
  11. <link rel="stylesheet" href="style.css">
  12. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
  13. <!-- 5秒后自身刷新 -->
  14. <meta http-equiv="refresh" content="5">
  15. <!-- 5秒后跳转新url -->
  16. <meta http-equiv="refresh" content="5; url=http://example.com">
  17. <!-- 视口属性,初始化页面放大两倍,用户禁止缩放 -->
  18. <meta name="viewport" content="initial-scale=2.0, user-scalable=no">
  19. <!-- 视口属性,初始化页面设备宽度,页面最多放大设备宽度2倍,最小缩小设备宽度1半 -->
  20. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=0.5">
  21. <!-- 内链样式和脚本 -->
  22. <style></style>
  23. <script src=""></script>
  24. <script></script>

3. body中常用标签

3.1 语义标签

  1. <!-- 头部标签 -->
  2. <header>
  3. <!-- 导航标签 -->
  4. <nav>导航</nav>
  5. </header>
  6. <!-- div标签 -->
  7. <div id="container">
  8. <!-- 主体标签 -->
  9. <main>
  10. <!-- 内容标签 -->
  11. <article>
  12. <p>一段内容<span>测试</span></p>
  13. </article>
  14. <!-- 区块标签 -->
  15. <section></section>
  16. </main>
  17. <!-- 侧栏标签 -->
  18. <aside>侧栏</aside>
  19. </div>
  20. <!-- 底部标签 -->
  21. <footer>
  22. <!-- 地址标签 -->
  23. <address>xxx路xx号</address>
  24. </footer>

3.2 文本格式标签

  1. <!-- strong 强调, b 加粗
  2. em 突出, i 倾斜
  3. del 删除线
  4. u 下划线
  5. mark 标记,为显示的文本添加背景色
  6. -->
  7. <p><strong>T</strong>his <b>text</b> is <i>only</i> for <em>test</em>. <u>you</u> can <del>delete</del>
  8. <mark>it</mark>.
  9. </p>
  10. <!-- sub 下标 sup 上标 -->
  11. <p>E=mc<sup>2</sup></p>
  12. <p>a<sub>n+1</sub>=a<sub>n</sub>+a<sub>n-1</sub>;(n>1;a<sub>1</sub>=1;a<sub>2</sub>=1)</p>
  13. <!-- bdo 覆盖默认文本的方向
  14. ltr: left to right, rtl: right to left -->
  15. <p><bdo dir="ltr">default</bdo> <bdo dir="rtl">text</bdo> direction</p>
  16. <!-- 详情隐藏细节 -->
  17. <details>
  18. <summary>click show detail</summary>
  19. This text is hidden detail, click to show.
  20. </details>
  21. <!-- 对话框,open 开启,去掉隐藏 -->
  22. <dialog open>hello world!</dialog>
  23. <pre>
  24. &lt;p&gt;hello world!&lt;/p&gt;
  25. </pre>
  26. <!-- 组合标签 -->
  27. <figure>
  28. <figcaption>组合标签标题</figcaption>
  29. <p><img src="https://www.baidu.com/img/flexible/logo/pc/result.png" alt="baidu"></p>
  30. </figure>

文本格式标签

3.3 列表标签

  1. 无序列表

    1. <ul>
    2. <li>ul-li-01</li>
    3. <li>ul-li-02</li>
    4. <li>ul-li-03</li>
    5. </ul>
  1. 有序列表

    1. <ol>
    2. <li>ol-li-01</li>
    3. <li>ol-li-02</li>
    4. <li>ol-li-03</li>
    5. </ol>
  1. 定义列表

    1. <dl>
    2. <dt>dl-dt</dt>
    3. <dd>dl-dd-01</dd>
    4. <dd>dl-dd-02</dd>
    5. <dd>dl-dd-03</dd>
    6. </dl>

列表标签

3.4 超链接标签

  1. <p><a href="https://www.php.cn" target="_blank">open in new window</a></p>
  2. <p><a href="https://www.php.cn" title="self">open in self window</a></p>

3.5 多媒体标签

  • 图像

    1. <p><img src="https://www.php.cn/static/images/PHPlogo.png" alt="logo" width="120"></p>
  • 音频和媒体源

    1. <p><audio src="https://www.w3school.com.cn/i/horse.mp3" controls="controls"></audio></p>
    2. <p>
    3. <!-- 载入时静音 -->
    4. <audio controls="controls" muted>
    5. <source src="https://www.w3school.com.cn/i/horse.ogg">
    6. <source src="https://www.w3school.com.cn/i/horse.mp3">
    7. </audio>
    8. </p>

    autoplay 自动播放,loop循环播放,muted 载入时静音

  • 视频和媒体源

    1. <p><video src="https://www.w3school.com.cn/i/movie.mp4" controls="controls" width="240" height="180"></video></p>
    2. <p>
    3. <!-- 显示封面 -->
    4. <video controls poster="https://www.php.cn/static/images/PHPlogo.png" width="240" height="180">
    5. <source src="https://www.w3school.com.cn/i/movie.ogg">
    6. <source src="https://www.w3school.com.cn/i/movie.mp4">
    7. </video>
    8. </p>

    autoplay 自动播放,loop循环播放,muted 载入时静音,preload=”url” 预加载视频,poster=”url” 视频显示封面

多媒体标签

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments