Blogger Information
Blog 9
fans 1
comment 0
visits 7030
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
HTML5常用元素
滑稽...
Original
511 people have browsed it

0403 html 基础知识

1.语义化元素

  • <h1> - <h6> :划分段落
  • <header></header>:页眉
  • <footer></footer>:页脚
  • <main></main>:主体
  • <aside></aside>:边栏
  • <section></section>:区块
  • <nav></nav>:导航
  • <div></div>:通用容器

1.1传统方式:非语义化结构

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>传统方式:非语义化结构</title>
  7. </head>
  8. <body>
  9. <!-- 页眉 -->
  10. <!-- .header>.nav>a{men$}*3 -->
  11. <div class="header">
  12. <div class="nav">
  13. <a href="">men1</a>
  14. <a href="">men2</a>
  15. <a href="">men3</a>
  16. </div>
  17. </div>
  18. <!-- 内容主体区 -->
  19. <div class="container">
  20. <!-- 边栏 -->
  21. <div class="aside">
  22. <div class="ads">广告位</div>
  23. </div>
  24. <!-- 主体区 -->
  25. <div class="main">
  26. <div class="article">
  27. <h3>php中文网</h3>
  28. <p>web开发者的家园</p>
  29. </div>
  30. </div>
  31. </div>
  32. <!-- 页脚 -->
  33. <!-- .footer>.links>a{links$}*3 -->
  34. <div class="footer">
  35. <div class="links">
  36. <a href="">links1</a>
  37. <a href="">links2</a>
  38. <a href="">links3</a>
  39. </div>
  40. </div>
  41. </body>
  42. </html>

1.2语义化结构

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>语义化结构</title>
  7. </head>
  8. <body>
  9. <!-- 页眉 -->
  10. <header>
  11. <nav>
  12. <a href="">men1</a>
  13. <a href="">men2</a>
  14. <a href="">men3</a>
  15. </nav>
  16. </header>
  17. <!-- 内容主体区 -->
  18. <div class="container">
  19. <!-- 边栏 -->
  20. <aside>
  21. <section class="ads">广告位</section>
  22. </aside>
  23. <!-- 主体区 -->
  24. <!-- main在一个页面只允许有一个 -->
  25. <main>
  26. <article>
  27. <h3>php中文网</h3>
  28. <p>web开发者的家园</p>
  29. </article>
  30. </main>
  31. </div>
  32. <!-- 页脚 -->
  33. <footer>
  34. <section class="links">
  35. <a href="">links1</a>
  36. <a href="">links2</a>
  37. <a href="">links3</a>
  38. </section>
  39. </footer>
  40. </body>
  41. </html>

2.语义化的文本元素

  • <p>,<pre>,<br>,<span>
  • <time>,<abbr>,<address>,<code>
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>语义化的文本元素</title>
  7. </head>
  8. <body>
  9. <time>2020-04-03</time>
  10. <p>
  11. <abbr title="超文本标记语言">HTML</abbr>
  12. </p>
  13. <!-- sup上标 -->
  14. <p>2<sup>4</sup>=16</p>
  15. </body>
  16. </html>

3.链接,列表与图像

  • <a>:链接
  • <ul><li>无序列表</li></ul>
  • <ol><li>有序列表</li></ol>
  • <img>

3.1链接

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>链接,列表与图像</title>
  7. </head>
  8. <body>
  9. <a href="https://www.php.cn/" target="_blank">php中文网</a>
  10. <a href="0403.md" download="html教案.md.zip">html教程</a>
  11. <a href="tel:15057327***">咨询热线</a>
  12. <a href="mailto:1234567@qq.com">邮箱联系</a>
  13. <a href="#anchor">跳转到锚点</a>
  14. <h2 id="anchor" style="margin-top: 1000px;">我是锚点</h2>
  15. </body>
  16. </html>

3.2列表

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>列表</title>
  7. </head>
  8. <body>
  9. <!-- 无序列表 -->
  10. <h3>购物车</h3>
  11. <ul>
  12. <li>苹果5斤</li>
  13. <li>梨5斤</li>
  14. <li>香蕉5斤</li>
  15. </ul>
  16. <!-- 有序列表 -->
  17. <h3>购物车</h3>
  18. <ol>
  19. <li>苹果5斤</li>
  20. <li>梨5斤</li>
  21. <li>香蕉5斤</li>
  22. </ol>
  23. <!-- 自定义列表 -->
  24. <dl>
  25. <dt>HTML</dt>
  26. <dd>超文本标记语言</dd>
  27. <dd>页面是由多个元素组成</dd>
  28. <dt>CSS</dt>
  29. <dd>层叠样式</dd>
  30. <dt>JavScript</dt>
  31. <dd>前端通用脚本语言</dd>
  32. </dl>
  33. </body>
  34. </html>

列表

4.表格与框架

  • <table> + <tr> + <td>
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>表格</title>
  7. </head>
  8. <body>
  9. <table
  10. border="1"
  11. cellpadding="20"
  12. cellspacing="0"
  13. width="500"
  14. height="300"
  15. align="center"
  16. >
  17. <!-- 表格列的颜色 -->
  18. <colgroup bgcolor="lightpink">
  19. <col />
  20. <col bgcolor="lightgreen" />
  21. <col bgcolor="yellow" span="2" />
  22. <col />
  23. </colgroup>
  24. <!-- 标题 -->
  25. <caption style="font-size: 1.5rem;margin-bottom: 10px;">
  26. 员工信息表
  27. </caption>
  28. <!-- 表头 -->
  29. <thead bgcolor="lightblue">
  30. <tr>
  31. <th>部门</th>
  32. <th>ID</th>
  33. <th>姓名</th>
  34. <th>职务</th>
  35. <th>手机</th>
  36. </tr>
  37. </thead>
  38. <!-- 表内容 -->
  39. <tbody>
  40. <tr>
  41. <td rowspan="3" align="center">销售部</td>
  42. <td>101</td>
  43. <td>小王</td>
  44. <td>主管</td>
  45. <td>1505732****</td>
  46. </tr>
  47. <tr>
  48. <!-- <td>销售部</td> -->
  49. <td>101</td>
  50. <td>小王</td>
  51. <td>主管</td>
  52. <td>1505732****</td>
  53. </tr>
  54. <tr>
  55. <!-- <td>销售部</td> -->
  56. <td>101</td>
  57. <td>小王</td>
  58. <td>主管</td>
  59. <td>1505732****</td>
  60. </tr>
  61. </tbody>
  62. <tbody>
  63. <tr>
  64. <td rowspan="3" align="center">开发部</td>
  65. <td>101</td>
  66. <td>小王</td>
  67. <td>主管</td>
  68. <td>1505732****</td>
  69. </tr>
  70. <tr>
  71. <!-- <td>开发部</td> -->
  72. <td>101</td>
  73. <td>小王</td>
  74. <td>主管</td>
  75. <td>1505732****</td>
  76. </tr>
  77. <tr>
  78. <!-- <td>开发部</td> -->
  79. <td>101</td>
  80. <td>小王</td>
  81. <td>主管</td>
  82. <td>1505732****</td>
  83. </tr>
  84. </tbody>
  85. <tfoot>
  86. <tr bgcolor="wheat">
  87. <td>备注:</td>
  88. <td colspan="4">colspan是合并列排单元格</td>
  89. </tr>
  90. </tfoot>
  91. </table>
  92. </body>
  93. </html>

Correcting teacher:天蓬老师天蓬老师

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
Author's latest blog post