HTML 实体速查表
有些字符在 HTML 里有特殊含义。想把它们当作文本显示,就要写实体:一个 &、名称或编号、一个分号。
保留字符 — 内容里必须转义
| 实体 | 数字形式 | 渲染结果 |
|---|---|---|
| < | < | < |
| > | > | > |
| & | & | & |
| " | " | " |
| ' | ' | ' |
符号与排版
| 实体 | 渲染结果 |
|---|---|
| | Non-breaking space |
| © · ® · ™ | © · ® · ™ |
| — · – · … | — · – · … |
| ← · → · ↓ · ↑ | ← · → · ↓ · ↑ |
| × · ÷ · − | × · ÷ · − |
| « · » | « · » |
| • · · | • · · |
| € · £ · ¥ | € · £ · ¥ |
常见问题
When is escaping actually required?
Always escape < and & when they appear as text — < starts a tag the parser will try to execute, and & starts an entity the parser will try to resolve. Quotes matter inside attribute values.
Why does © render literally sometimes?
A missing semicolon. Browsers repair some entity typos, but only named entities with semicolons are guaranteed — write © not ©.
Entity vs numeric reference?
Named (©) is readable; numeric (©) covers every Unicode character, including ones with no named entity. Both are ASCII-safe for emails and old parsers.