HTML Entities and Symbols
HTML Entities और Symbols
Why Entities Exist — the reserved-characters problem
<p>Rule: if marks < 33 then FAIL</p> ← we WANT to show the < sign
What the browser thinks: "marks " ... then "< 33 then FAIL..."
starts looking like a TAG! Text after it may vanish.
< starts a tag, > ends it, & starts an entity, quotes delimit attribute values. To DISPLAY these characters as normal text, you must write their entity code — a stand-in the browser converts back to the symbol without treating it as grammar. Exactly like saying "the word 'and'" vs using "and" in a sentence — sometimes you mention a symbol instead of using it.The Pattern
&name; starts with & → short name → ends with ;
₹ number form: & # code ;
< → < (lt = less than)
> → > (gt = greater than)
& → & (the & itself needs an entity too!)
Fun fact you have already benefited from: every code example on THIS page is written with entities — that is exactly how a coding tutorial shows HTML without the browser executing it. You now know our secret.
The Table You Will Actually Use
| Entity | Shows | Name / use |
|---|---|---|
| < > | < > | Show tags/comparisons as text |
| & | & | Ampersand — required in URLs inside HTML |
| " ' | " ' | Quotes inside attribute values |
| | (space) | Non-breaking space — next section |
| © ® ™ | © ® ™ | Footer copyright lines |
| ₹ | ₹ | Indian Rupee — every fee table needs it |
| × ÷ | × ÷ | Real multiplication/division signs (not x and /) |
| → ← | → ← | Arrows for steps and navigation hints |
| ♥ ★ | ♥ ★ | Ratings, likes |
Honest modern note: with UTF-8 (our meta charset line!) you can paste ©, ₹, → directly and they work. Entities remain essential for the grammar characters (< > &) — those can NEVER be typed raw — and handy when you can't easily type a symbol.
The nbsp Special Case — a space that refuses to break
Normal space: Dr. A. P. J. Abdul
Kalam ← line broke INSIDE the name!
With nbsp: Dr. A. P. J. Abdul Kalam
← the whole name wraps as ONE unit
Exam Corner
Q: Full form and use of ? Non-breaking space — keeps two words together across line breaks and doesn't collapse like normal spaces.
Q: Entity for ©? For ₹? © and ₹.
Q: Why must & in a URL be written as &? Because a raw & starts an entity — the validator flags it and some following text can be misread.
Entities क्यों हैं — reserved characters की problem
<p>Rule: if marks < 33 then FAIL</p> ← humein < ka nishan DIKHANA hai
Browser kya samajhta hai: "marks " ... phir "< 33 then FAIL..."
TAG jaisa lagne lagta hai! Aage ka text gayab ho sakta hai.
< tag शुरू करता है, > खत्म, & entity शुरू करता है, quotes attribute values घेरते हैं. इन्हें normal text की तरह DIKHANE के लिए उनका entity code लिखना पड़ता है — एक बदली जिसे browser बिना grammar समझे वापस symbol बना देता है. बिल्कुल जैसे "'और' शब्द" कहना vs वाक्य में "और" use करना — कभी-कभी symbol को use नहीं, mention करना होता है.Pattern
&name; & se shuru → chhota naam → ; par khatam
₹ number roop: & # code ;
< → < (lt = less than)
> → > (gt = greater than)
& → & (khud & ko bhi entity chahiye!)
मज़ेदार बात जिसका फायदा आप उठा ही चुके हैं: इस page का हर code example entities से लिखा है — coding tutorial HTML को बिना browser के चलाए ऐसे ही दिखाता है. अब आप हमारा राज़ जानते हैं.
वह Table जो सच में काम आएगी
| Entity | दिखाता है | नाम / use |
|---|---|---|
| < > | < > | Tags/comparisons text की तरह दिखाना |
| & | & | Ampersand — HTML के अंदर URLs में ज़रूरी |
| " ' | " ' | Attribute values के अंदर quotes |
| | (space) | Non-breaking space — अगला section |
| © ® ™ | © ® ™ | Footer की copyright lines |
| ₹ | ₹ | Indian Rupee — हर fee table की ज़रूरत |
| × ÷ | × ÷ | असली गुणा/भाग के निशान (x और / नहीं) |
| → ← | → ← | Steps और navigation hints के arrows |
| ♥ ★ | ♥ ★ | Ratings, likes |
ईमानदार modern note: UTF-8 के साथ (हमारी meta charset line!) ©, ₹, → सीधे paste करने पर भी चलते हैं. Entities grammar characters (< > &) के लिए अनिवार्य रहती हैं — वे raw कभी type नहीं हो सकते — और तब काम आती हैं जब symbol आसानी से type न हो.
nbsp का Special Case — वह space जो टूटने से मना करता है
Normal space: Dr. A. P. J. Abdul
Kalam ← line NAAM ke andar toot gayi!
nbsp ke saath: Dr. A. P. J. Abdul Kalam
← poora naam EK unit ki tarah wrap hota hai
Exam Corner
Q: की full form और use? Non-breaking space — दो शब्दों को line breaks के पार साथ रखता है और normal spaces की तरह collapse नहीं होता.
Q: © की entity? ₹ की? © और ₹.
Q: URL के & को & क्यों लिखना चाहिए? क्योंकि raw & entity शुरू कर देता है — validator flag करता है और आगे का कुछ text गलत पढ़ा जा सकता है.
💻 Live Code Editor
इस पेज का code यहाँ तैयार है — बदलिए और तुरंत नतीजा देखिए. कुछ install किए बिना.console.log देखने के लिए F12 दबाइए.