ESC
Entiti HTML

Reserved Characters

Decimal Hex Named Char Description
& & & & Ampersand — must always be encoded in HTML
&#60; &#x3C; &lt; < Less-than — opens HTML tags
&#62; &#x3E; &gt; > Greater-than — closes HTML tags
&#34; &#x22; &quot; " Double quote — use inside attribute values
&#39; &#x27; &#39; ' Single quote / apostrophe — no named entity in HTML4
&#47; &#x2F; &#47; / Forward slash — safe to use unencoded in most contexts

Common Symbols

Decimal Hex Named Char Description
&#169; &#xA9; &copy; © Copyright sign
&#174; &#xAE; &reg; ® Registered trademark
&#8482; &#x2122; &trade; Trademark symbol
&#8364; &#x20AC; &euro; Euro sign
&#163; &#xA3; &pound; £ Pound sterling sign
&#165; &#xA5; &yen; ¥ Yen / yuan sign
&#167; &#xA7; &sect; § Section sign
&#176; &#xB0; &deg; ° Degree sign
&#177; &#xB1; &plusmn; ± Plus-minus sign
&#215; &#xD7; &times; × Multiplication sign
&#247; &#xF7; &divide; ÷ Division sign
&#178; &#xB2; &sup2; ² Superscript two / squared
&#179; &#xB3; &sup3; ³ Superscript three / cubed

Arrows

Decimal Hex Named Char Description
&#8592; &#x2190; &larr; Leftwards arrow
&#8594; &#x2192; &rarr; Rightwards arrow
&#8593; &#x2191; &uarr; Upwards arrow
&#8595; &#x2193; &darr; Downwards arrow
&#8596; &#x2194; &harr; Left-right arrow
&#8656; &#x21D0; &lArr; Leftwards double arrow
&#8658; &#x21D2; &rArr; Rightwards double arrow
&#8660; &#x21D4; &hArr; Left-right double arrow

Mathematical

Decimal Hex Named Char Description
&#8721; &#x2211; &sum; Summation / sigma
&#8730; &#x221A; &radic; Square root radical sign
&#8734; &#x221E; &infin; Infinity symbol
&#960; &#x3C0; &pi; π Greek letter pi
&#8776; &#x2248; &asymp; Almost equal to
&#8800; &#x2260; &ne; Not equal to
&#8804; &#x2264; &le; Less than or equal to
&#8805; &#x2265; &ge; Greater than or equal to
&#177; &#xB1; &plusmn; ± Plus or minus

Smart Quotes & Dashes

Decimal Hex Named Char Description
&#8220; &#x201C; &ldquo; Left double quotation mark (opening)
&#8221; &#x201D; &rdquo; Right double quotation mark (closing)
&#8216; &#x2018; &lsquo; Left single quotation mark (opening)
&#8217; &#x2019; &rsquo; Right single quotation mark (closing)
&#8212; &#x2014; &mdash; Em dash — used for parenthetical clauses
&#8211; &#x2013; &ndash; En dash — used in ranges (pages 5–10)

Whitespace

Decimal Hex Named Char Description
&#160; &#xA0; &nbsp; [nbsp] Non-breaking space — prevents line break
&#8194; &#x2002; &ensp; [ensp] En space — width of letter n
&#8195; &#x2003; &emsp; [emsp] Em space — width of letter m
&#8201; &#x2009; &thinsp; [thinsp] Thin space — about 1/5 of em

Soalan Lazim

Entiti HTML ialah rentetan teks yang bermula dengan & dan berakhir dengan ; digunakan untuk mewakili aksara yang mempunyai makna khas dalam HTML atau tidak mudah ditaip. Contohnya &lt; dipaparkan sebagai < (tanda kurang daripada), yang sebaliknya akan ditafsirkan sebagai permulaan tag HTML.

Sentiasa ekodkan & sebagai &amp;, < sebagai &lt;, dan > sebagai &gt; dalam kandungan HTML untuk mengelakkannya diurai sebagai markup. Dalam nilai atribut, ekodkan juga petikan. Dalam amalan, enjin templat mengendalikan ini secara automatik dengan fungsi seperti htmlspecialchars() dalam PHP atau html.escape() dalam Python.

Ruang biasa ialah pemisah perkataan dan pelayar mungkin meruntuhkan berbilang ruang atau membungkus teks pada ruang. &nbsp; (ruang tidak memecah, U+00A0) menghalang pemisahan baris di titik tersebut dan tidak diruntuhkan. Gunakannya untuk unit (10&nbsp;kg) atau singkatan. Jangan gunakannya untuk susun atur — gunakan CSS padding/margin sebaliknya.