HTML 基本文档
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>文档标题</title></head><body>可见文本...</body>
</html>
基本标签(Basic Tags)
<h1>最大的标题</h1>
<h2> . . . </h2>
<h3> . . . </h3>
<h4> . . . </h4>
<h5> . . . </h5>
<h6>最小的标题</h6>
<hr size="2px" color="blue" width="80%" align="left"> (水平线)
<p>这是一个段落。</p>
<br> (换行)
<font face="楷体" size="6" color="red">字体标签</font>
文本格式化(Formatting)
<b>粗体文本</b>
<code>计算机代码</code>
<em>强调文本</em>
<i>斜体文本</i>
<u>有下划线文本</u>
<kbd>键盘输入</kbd>
<pre>预格式化文本</pre>
<small>更小的文本</small>
<strong>重要的文本</strong>
<abbr> (缩写)
<address> (联系信息)
<bdo> (文字方向)
<blockquote> (从另一个源引用的部分)
<cite> (工作的名称)
<del> (删除的文本)
<ins> (插入的文本)
<sub> (下标文本)
<sup> (上标文本)
链接(Links)
普通的链接:<a href="http://www.example.com/">链接文本</a>
图像链接: <a href="http://www.example.com/"><img src="URL" title="点我到达..." alt="替换文本"></a>
邮件链接: <a href="mailto:webmaster@example.com">发送e-mail</a>
书签:
<a id="tips">提示部分</a>
<a href="#tips">跳到提示部分</a>
图片(Images)
<img src="URL" title="图片标题" alt="替换文本" height="42" width="42">
样式/区块(Styles/Sections)
<style type="text/css">h1 {color:red;}p {color:blue;}
</style>
<div>文档中的块级元素</div> 占一整行)
<span>文档中的内联元素</span> 占一块)
无序列表
<ul><li>项目</li><li>项目</li>
</ul>
有序列表
<ol><li>第一项</li><li>第二项</li>
</ol>
定义列表
<dl><dt>项目 1</dt><dd>描述项目 1</dd><dt>项目 2</dt><dd>描述项目 2</dd>
</dl>
表格(Tables)
<table border="1"><tr><th>表格标题</th><th>表格标题</th></tr><tr><td>表格数据</td><td>表格数据</td></tr>
</table>
框架(Iframe)
<iframe src="demo_iframe.htm"></iframe>
表单(Forms)
<form action="demo_form.php" method="post/get">
<input type="text" name="email" size="40" maxlength="50"> (普通文本)
<input type="password"> (密码框)
<label for="name">用户名:</label> (label的for属性指向input标签的id属性)
<input type="text" id="name" name="name" required>
<input type="radio" checked="checked"> (单选框)
<input type="checkbox" checked="checked"> (复选框)
<input type="file"/> (上传文件)
<input type="date"/> (选择时间)
<input type="submit" value="Send"> (提交按钮)
<input type="reset"> (重置按钮)
<input type="hidden"> (隐藏域)
<select> (下拉选择框)
<option>苹果</option>
<option selected="selected">香蕉</option>
<option>樱桃</option>
</select>
<textarea name="comment" rows="60" cols="20"></textarea> (from标签的子标签,多行文本域)
</form>
标签通用属性:name(元素名),value(选择默认值),checked(默认选中),readonly(是否只读),disabled(是否可用),placeholder(提示信息)
实体(Entities)
< 等同于 <
> 等同于 >
© 等同于 ©
等同于 半个英语字母英文空格
  等同于 一个汉字中文空格
& 等同于&
× 等同于×
¥ 等同于¥
$ $
示例
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><title>我的示例页面</title><style type="text/css">h1 {color: red;}p {color: blue;}</style>
</head>
<body><h1>这是我的示例页面</h1>
<h2>基本内容</h2>
<p>这是一个段落,包含 <b>粗体文本</b> 和 <i>斜体文本</i>。</p><h3>文本格式化示例</h3>
<p><em>强调文本</em>, <kbd>键盘输入</kbd>,
<pre>预格式化文本</pre>
,
<small>更小的文本</small>, <strong>重要的文本</strong>
</p><h2>链接示例</h2>
<p>普通的链接:<a href="http://www.example.com/">访问示例网站</a></p>
<p>邮件链接:<a href="mailto:webmaster@example.com">发送邮件</a></p><h2>图片示例</h2>
<p><img src="https://via.placeholder.com/150" alt="替换文本" height="150" width="150"></p><h2>列表示例</h2>
<h3>无序列表</h3>
<ul><li>无序项目 1</li><li>无序项目 2</li>
</ul><h3>有序列表</h3>
<ol><li>第一项</li><li>第二项</li>
</ol><h3>定义列表</h3>
<dl><dt>项目 1</dt><dd>描述项目 1</dd><dt>项目 2</dt><dd>描述项目 2</dd>
</dl><h2>表格示例</h2>
<table border="1"><tr><th>表头 1</th><th>表头 2</th></tr><tr><td>表格数据 1</td><td>表格数据 2</td></tr>
</table><h2>框架示例</h2>
<iframe src="https://www.example.com" width="600" height="400"></iframe><h2>表单示例</h2>
<form action="demo_form.php" method="post"><label for="email">邮箱:</label><input type="text" id="email" name="email" size="40" maxlength="50"><br><br><label for="password">密码:</label><input type="password" id="password" name="password"><br><br><input type="checkbox" id="subscribe" name="subscribe" checked><label for="subscribe">订阅</label><br><input type="radio" id="option1" name="option" checked><label for="option1">选项 1</label><br><input type="radio" id="option2" name="option"><label for="option2">选项 2</label><br><input type="submit" value="发送"><input type="reset" value="重置"><br><br><select><option>苹果</option><option selected="selected">香蕉</option><option>樱桃</option></select><br><br><textarea name="comment" rows="4" cols="50" placeholder="在这里输入评论..."></textarea>
</form><h2>实体示例</h2>
<p>使用实体:< 等同于 <, > 等同于 >, © 等同于 ©.</p><hr>
<footer><address>联系信息:<a href="mailto:webmaster@example.com">webmaster@example.com</a></address>
</footer>
</body>
</html>