View on GitHub

个人笔记

SongPinru 的小仓库

HTML 基本文档

<!DOCTYPE html>
<html>
<head>
<title>文档标题</title>
</head>
<body>
可见文本...
</body>
</html>

基本标签(Basic Tags)

<h1>最大的标题</h1>
<h2> . . . </h2>
<h3> . . . </h3>
<h4> . . . </h4>
<h5> . . . </h5>
<h6>最小的标题</h6>
 
<p>这是一个段落。</p>
<br> (换行)
<hr> (水平线)
<!-- 这是注释 -->

文本格式化(Formatting)

<b>粗体文本</b>
<i>斜体文本</i>
<u>下划线</u>
<s>删除线</s>

<strong>重要的文本</strong>
<em>强调文本</em>
<ins> (插入的文本)
<del> (删除的文本)

<code>计算机代码</code>
<kbd>键盘输入</kbd> 
<pre>预格式化文本</pre>
<small>更小的文本</small>

 
<abbr> (缩写)
<address> (联系信息)
<bdo> (文字方向)
<blockquote> (从另一个源引用的部分)
<cite> (工作的名称)

<sub> (下标文本)
<sup> (上标文本)
普通的链接:<a href="http://www.example.com/">链接文本</a>
图像链接: <a href="http://www.example.com/"><img src="URL" alt="替换文本"></a>
邮件链接: <a href="mailto:webmaster@example.com">发送e-mail</a>
书签:
<a id="tips">提示部分</a>
<a href="#tips">跳到提示部分</a>

图片(Images)

<img loading="lazy" src="URL" 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">
<input type="checkbox" checked="checked">
<input type="radio" checked="checked">
<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>
 
</form>

实体(Entities)

&lt; 等同于 <
&gt; 等同于 >
&#169; 等同于 ©

HTML 标签简写及全称

下表列出了 HTML 标签简写及全称:

标签 英文全称 中文说明
a Anchor
abbr Abbreviation 缩写词
acronym Acronym 取首字母的缩写词
address Address 地址
alt alter 替用(一般是图片显示不出的提示)
b Bold 粗体(文本)
bdo Direction of Text Display 文本显示方向
big Big 变大(文本)
blockquote Block Quotation 区块引用语
br Break 换行
cell cell
cellpadding cellpadding 巢补白
cellspacing cellspacing 巢空间
center Centered 居中(文本)
cite Citation 引用
code Code 源代码(文本)
dd Definition Description 定义描述
del Deleted 删除(的文本)
dfn Defines a Definition Term 定义定义条目
div Division 分隔
dl Definition List 定义列表
dt Definition Term 定义术语
em Emphasized 加重(文本)
font Font 字体
h1~h6 Header 1 to Header 6 标题1到标题6
hr Horizontal Rule 水平尺
href hypertext reference 超文本引用
i Italic 斜体(文本)
iframe Inline frame 定义内联框架
ins Inserted 插入(的文本)
kbd Keyboard 键盘(文本)
li List Item 列表项目
nl navigation lists 导航列表
ol Ordered List 排序列表
optgroup Option group 定义选项组
p Paragraph 段落
pre Preformatted 预定义格式(文本 )
q Quotation 引用语
rel Reload 加载
s/ strike Strikethrough 删除线
samp Sample 示例(文本
small Small 变小(文本)
span Span 范围
src Source 源文件链接
strong Strong 加重(文本)
sub Subscripted 下标(文本)
sup Superscripted 上标(文本)
td table data cell 表格中的一个单元格
th table header cell 表格中的表头
tr table row 表格中的一行
tt Teletype 打印机(文本)
u Underlined 下划线(文本)
ul Unordered List 不排序列表
var Variable 变量(文本)