Kanbritech Learn logo
HTML HTML Tutorial 45h track

HTML Entities

Display the literal text A < B & C.

Understand the topic

Character references represent characters that would otherwise be ambiguous or inconvenient in HTML source. &lt; represents a less-than sign and &amp; represents an ampersand. Numeric references use a decimal or hexadecimal code point. Ordinary Unicode text is usually clearer for normal prose when the document uses UTF-8. Escape characters whenever inserting untrusted text into markup.

Worked example

<p>Write &lt;h1&gt; for a main heading.</p>
<p>Tea &amp; coffee</p>
<p>Copyright: &copy; or &#169;</p>

The browser resolves character references into visible characters. In the first line, the heading syntax is text rather than a real heading element.

Practice

Display the literal text A < B & C.

Show a suggested answer
<p>A &lt; B &amp; C</p>

Common mistake

Do not double-escape already escaped content unless you intentionally want visitors to see the entity spelling.

HTML documentation

Live Example

Try Coding

Result