Entity - MDN Web Docs Glossary: Definitions of Web-related terms 编辑

An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;) . Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces). You can also use them in place of other characters that are difficult to type with a standard keyboard. 

Many characters have memorable entities. For example, the entity for the copyright symbol (©) is ©. For less memorable characters, such as — or —, you can use a reference chart or decoder tool.

Reserved characters

Some special characters are reserved for use in HTML, meaning that your browser will parse them as HTML code. For example, if you use the less-than (<) sign, the browser interprets any text that follows as a tag.

To display these characters as text, replace them with their corresponding character entities, as shown in the following table.

CharacterEntityNote
&&amp;Interpreted as the beginning of an entity or character reference.
<&lt;Interpreted as the beginning of a tag
>&gt;Interpreted as the ending of a tag
"&quot;Interpreted as the beginning and end of an attribute's value.

Learn more

Technical reference

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:42 次

字数:2666

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文