提交学习笔记专用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

228 lines
5.6 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8"><!--定义字符集为UTF-8-->
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <!--设置自适应视口以确保响应式设计-->
  7. <title>HTML学习1</title>
  8. <!--外部样式表-->
  9. <link rel="stylesheet" type="text/css" href="mystyle.css">
  10. <!--内部样式表-->
  11. <style type="text/css">
  12. h1 {color: red}
  13. p {color: blue}
  14. .cities {
  15. background-color:black;
  16. color:white;
  17. margin:20px;
  18. padding:20px;
  19. }
  20. #myHeader {
  21. background-color: lightblue;
  22. color: black;
  23. padding: 40px;
  24. text-align: center;
  25. }
  26. </style>
  27. </head>
  28. <body><!--<body> 元素定义了 HTML 文档的主体-->>
  29. <!--标题 h1(大)到h6-->
  30. <h1>学习笔记</h1>
  31. <!--段落-->
  32. <p>今天学习了很多新的知识,感觉收获颇丰。</p>
  33. <!--水平线-->
  34. <hr/>
  35. <!--插入空行/换行-->
  36. <p>This is<br />a para<br />graph with line breaks</p>
  37. <br />
  38. <p>今天学习了很多新的知识,感觉收获颇丰。</p>
  39. <!--链接-->
  40. <a href="http://www.w3school.com.cn">这是web学习网站</a>
  41. <br />
  42. <a name="label" href="http://www.w3school.com.cn/" target="_blank">Visit W3School!</a>
  43. <br />
  44. <a href="#label">在同一个文档中创建指向该锚的链接</a>
  45. <br />
  46. <a href="http://www.w3school.com.cn/#label">在其他页面中创建指向该锚的链接</a>
  47. <br />
  48. <!--图片-->
  49. <img src="http://www.w3school.com.cn/images/boat.gif" alt="Big Boat" width="104" height="142"/>
  50. <!--HTML元素:从开始标签(start tag)到结束标签(end tag)的所有代码-->
  51. <!--HTML属性:提供有关元素的附加信息 始终为属性值加引号
  52. class = "value":为元素指定类名
  53. id="value":为元素指定唯一的标识符
  54. style="property:value;":为元素添加内联样式
  55. title="text":为元素添加提示文本
  56. <table border="1">:为表格添加边框
  57. -->
  58. <!--HTML样式-->
  59. <h1 style="text-align:center;">水平居中对齐</h1>
  60. <p style="font-family:arial; color:red; font-size:20px;">A paragraph.</p>
  61. <!--预格式文本,保留了空格和换行-->
  62. <pre>
  63. for i = 1 to 10
  64. print i
  65. next i
  66. </pre>
  67. <!--地址-->
  68. <address>
  69. Written by <a href="Wugh5200@163.com">Donald Duck</a>.<br>
  70. Visit us at:<br>
  71. Example.com<br>
  72. Box 564, Disneyland<br>
  73. USA
  74. </address>
  75. <br />
  76. <!--缩写和首字母缩写-->
  77. <abbr title="etcetera">etc.</abbr>
  78. <br />
  79. <acronym title="World Wide Web">WWW</acronym>
  80. <p><dfn><abbr title="World Health Organization">WHO</abbr></dfn> 成立于 1948 年。</p>
  81. <br />
  82. <!--引用-->
  83. <q>学习使我快乐。</q>
  84. <br />
  85. <blockquote cite="http://www.w3school.com.cn">
  86. 学习使我快乐。
  87. </blockquote>
  88. <!--表格
  89. <table>:定义表格
  90. <tr>:定义表格行
  91. <th>:定义表格头单元格
  92. <td>:定义表格数据单元格
  93. cellspacing:单元格间距
  94. cellpadding:单元格内边距
  95. -->
  96. <table border="1" cellpadding="10" cellspacing="5" bgcolor="#FAEBD7">
  97. <caption>标题</caption>
  98. <tr>
  99. <th colspan="2">Heading</th><!--横跨两列-->
  100. <th rowspan="2">Another Heading</th><!--横跨两行-->
  101. </tr>
  102. <tr>
  103. <td>row 1, cell 1</td>
  104. <td>row 1, cell 2</td>
  105. </tr>
  106. <tr>
  107. <td>&nbsp;</td>
  108. <td>row 2, cell 2</td>
  109. </tr>
  110. <tr>
  111. <td>这个单元包含一个表格:
  112. <table border="1">
  113. <tr>
  114. <td align="left">A</td>
  115. <td align="right">B</td>
  116. </tr>
  117. <tr>
  118. <td>C</td>
  119. <td>D</td>
  120. </tr>
  121. </table>
  122. </td>
  123. </tr>
  124. <tr>
  125. <td>这个单元包含一个列表:
  126. <ul>
  127. <li>苹果</li>
  128. <li>香蕉</li>
  129. <li>菠萝</li>
  130. </ul>
  131. </td>
  132. <td>HELLO</td>
  133. </tr>
  134. </table>
  135. <!--列表-->
  136. <h2>无序列表</h2>
  137. <!--type="disc" type="circle" type="square"-->
  138. <ul type="disc">
  139. <li>Coffee</li>
  140. <li>Milk</li>
  141. </ul>
  142. <h2>有序列表</h2>
  143. <ol type="A">
  144. <!--type="A" type="a" type="I" type="i"-->
  145. <li>Coffee</li>
  146. <li>Milk</li>
  147. </ol>
  148. <h2>嵌套列表:</h2>
  149. <ul>
  150. <li>咖啡</li>
  151. <li>
  152. <ul>
  153. <li>红茶</li>
  154. <li>绿茶</li>
  155. </ul>
  156. </li>
  157. <li>牛奶</li>
  158. </ul>
  159. <h2>定义列表:</h2>
  160. <dl> <!--自定义列表以 <dl> 标签开始-->
  161. <dt>计算机</dt> <!--每个自定义列表项以 <dt> 开始-->
  162. <dd>用来计算的仪器 ... ...</dd> <!--每个自定义列表项的定义以 <dd> 开始-->
  163. <dt>显示器</dt>
  164. <dd>以视觉方式显示信息的装置 ... ...</dd>
  165. </dl>
  166. <!--块级标签默认独占一行:<div>、<h1>-<h6>、<p>、<form>、<ul>、<dl>;
  167. 行内标签:<span><input><img>。-->
  168. <!--同一个类名可以由多个 HTML 元素使用,而一个 id 名称只能由页面中的一个 HTML 元素使用:-->
  169. <!---->
  170. <div class="cities">
  171. <h2>London</h2>
  172. <p>
  173. London is the capital city of England.
  174. It is the most populous city in the United Kingdom,
  175. with a metropolitan area of over 13 million inhabitants.
  176. </p>
  177. </div>
  178. <!--id-->
  179. <h1 id="myHeader">My Header</h1>
  180. <!--通过 ID 和链接实现 HTML 书签-->
  181. <h2 id="C4">第四章</h2>
  182. <a href="#C4">跳转到第四章</a>
  183. <!--或者,在另一张页面中,添加指向这个书签的链接(“跳转到第四章”)-->
  184. <a href="html_demo.html#C4">Jump to Chapter 4</a>
  185. </body>
  186. </html>