HTML基础知识笔记
HTML 指的是超文本标记语言 (Hyper Text Markup Language)
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>hello html</p>
</body>
</html>
参考教程:
HTML 标签
- 标题
<h1>This is a heading</h1> - 段落
<p>This is a paragraph</p> - 链接
<a href="http://www.w3school.com.cn">This is a link</a> - 图像
<img src="w3school.jpg" width="104" height="142" />
HTML 元素: 指的是从开始标签(start tag)到结束标签(end tag)的所有代码。
HTML 属性: 标签可以拥有属性,以名称/值对的形式出现,总是在 HTML 元素的开始标签中规定。
- class 可重复
<div class="cities"><p>London</p></div> - id 唯一
<h1 id="myHeader">My Header</h1> - style
<p style="background-color:green">This is a green</p>
HTML 注释: <!-- This is a comment -->
HTML 表格
<table border="1">
<tr>
<th>表头1</th>
<th>表头2</th>
</tr>
<tr>
<td>行 1, 列 1</td>
<td>行 1, 列 2</td>
</tr>
<tr>
<td>行 2, 列 1</td>
<td>行 2, 列 2</td>
</tr>
</table>
HTML 有序、无序列表
<!-- 有序列表 -->
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
<!-- 无序列表 -->
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
元素组合
<div> 块级元素,常用于组合其他 HTML 元素的容器
<div class="cities"><p>London</p></div>
<span> 内联元素,常用作文本的容器,不换行
<h1>My <span class="red">Important</span> Heading</h1>
HTML 表单
HTML 表单用于搜集不同类型的用户输入
<form action="url_to_server_script" method="GET/POST">
<!-- form elements go here -->
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br>
<button type="submit">Submit</button>
</form>

浙公网安备 33010602011771号