特殊符号的使用
一、HTML实体
- 在 HTML 中,某些字符是预留的。如不能使用小于号(<)和大于号(>),这是因为浏览器会误认为它们是标签。要正确的显示预留字符,就需在 HTML 源代码中使用字符实体(character entities)。
符号 | 实体名称 | 实体数值 | 描述 |
---|---|---|---|
|   | 空格 | |
< | < | < | 小于 |
> | > | > | 大于 |
& | & | & | 连接符 |
“” | " | " | 双引号 |
± | ± | ± | 正负值 |
© | © | © | 著作权 |
其他特殊符号可以在网上搜索 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>symbol</title>
</head>
<body>
<table border="1" align="center">
<caption><font color="green" face="仿宋">特殊符号的使用</font></caption>
<colgroup style="width: 100px " span="1">
<col style="background: white" span="1">
</colgroup>
<colgroup style="width: 200px " span="2">
<col style="background: grey" span="2">
</colgroup>
<colgroup style="width: 100px" span="1">
<col style="background: white" span="1">
</colgroup>
<thead style="background: #FFEBCD">
<tr>
<th>符号</th><th>实体名称</th><th>实体数值</th><th>描述</th>
</tr>
</thead>
<tbody align="center">
<tr>
<td></td><td>&nbsp;</td><td>&#160;</td><td>空格</td>
</tr>
<tr>
<td><</td><td>&lt;</td><td>&#62;</td><td>小于</td>
</tr>
<tr>
<td>></td><td>&gt;</td><td>&#38;</td><td>大于</td>
</tr>
<tr>
<td>&</td><td>&amp;</td><td>&#38;</td><td>连接符</td>
</tr>
<tr>
<td>±</td><td>&plusmn;</td><td>&#177;</td><td>正负号</td>
</tr>
<tr>
<td>©</td><td>&copy;</td><td>&#169;</td><td>著作权</td>
</tr>
</tbody>
<tfoot>
<td colspan="4" style="background: pink">其他的特殊符号可在网上搜索</td>
</tfoot>
</table>
</body>
</html>
浏览器页面显示如下:
在实体名称的表达式前加上&,使表达式在页面上显示出来(<td></td><td>&nbsp;</td><td>&#160;</td><td>空格</td>
)。