R
Rishtaara
HTML & CSS: Zero to Hero
Lesson 11 of 28Article13 min

Entities, Symbols, Charset & XHTML

Some characters break HTML if typed raw — like < and &. Use entities: &lt; for <, &gt; for >, &amp; for &.

HTML Entities

Some characters break HTML if typed raw — like < and &. Use entities: &lt; for <, &gt; for >, &amp; for &.

Entities start with & and end with ;. They display as normal characters in the browser.

Real-life example: Entities are like escape codes — you write a secret symbol so the system knows you mean a literal < not a new tag.

Common entities
<p>5 &lt; 10 and Tom &amp; Jerry</p>
<p>Copyright &copy; 2026 Rishtaara</p>

HTML Symbols

Many math and currency symbols have entities or Unicode: & euro;, & pound;, & times;, & divide;, & plusmn;.

You can also paste Unicode characters directly if your file is UTF-8.

Real-life example: Symbols are like special keys on a Hindi-English keyboard — one code gives ₹, ©, or °.

Symbols
<p>Temperature: 25&deg;C</p>
<p>Price: &euro;10 or &#8377;999</p>

HTML Emojis

Emojis are Unicode characters. With UTF-8 charset you can type them directly: 😀 🎉 📚.

Decimal or hex codes also work: &#128512; for 😀.

Real-life example: Emojis in HTML are like stickers on your notebook — same stickers work if your notebook supports Unicode (UTF-8).

Emojis
<p>Welcome to the course! 🎉</p>
<p>Code emoji: &#128218;</p>

HTML Charset

<meta charset="UTF-8" /> in head tells the browser to read all languages, symbols, and emoji correctly.

Save your .html files as UTF-8 in your editor. Without this, Hindi or emoji may show as boxes.

Real-life example: Charset is like choosing Hindi+English keyboard layout — wrong layout and typing looks broken.

UTF-8 charset
<head>
  <meta charset="UTF-8" />
  <title>नमस्ते — Hello</title>
</head>

URL Encode

URLs cannot have spaces or special characters raw. Browsers encode them: space becomes %20, & becomes %26.

When you build links in JavaScript, use encodeURIComponent() for query values.

Real-life example: URL encode is like writing PIN code in an address — spaces and symbols get a safe coded form for the post office.

Encoded URL
<a href="https://example.com/search?q=html%20tutorial">Search HTML tutorial</a>

HTML vs XHTML

XHTML was a stricter version — all tags closed, lowercase, quoted attributes. HTML5 is the standard today and is more forgiving.

Write clean HTML5 anyway: close tags, quote attributes, one root <html>. That habit works everywhere.

Real-life example: XHTML was like strict exam handwriting rules. HTML5 is the friendly teacher — but neat writing still gets better marks.

  • Use <!DOCTYPE html> for HTML5
  • Close tags and quote attributes for quality
  • XHTML is legacy — learn HTML5
Tip: Always set charset UTF-8 so Hindi text and emoji work on Rishtaara pages.