Reputation: 28334
For example, suppose I want to put an en dash in my page title, like this:
Home – My Site
Is there any reason to use –
over just putting the character –
in my HTML file?
Upvotes: 4
Views: 1134
Reputation:
If you use the less than (<) or greater than (>) signs in your text, the browser might mix them with tags. W3Schools.com
The only other HTML entities I would probably ever use would be
and &
unless a specific issue came about.
Upvotes: 1
Reputation: 1658
It is definitely needed if you want to render characters that will mess up the HTML parser (<
and >
, and the &
itself).
If you set the character set to UTF-8, then you can use other raw UTF8 characters.
<meta charset='utf-8'>
However some older browsers don't understand this tag, so they might not render UTF-8 characters properly.
I also wanted to point out - HTML entities are sometimes used to tell the browser to render a concept, rather than a specific character. Some browsers prefer to render entities in a more readable way than a Unicode character, for example Lynx renders ™
as (tm)
instead of ™
Upvotes: 4
Reputation: 9782
If an HTML entity exists for the character you want to use, you should use the HTML entity. That ensures it displays as intended.
http://www.danshort.com/HTMLentities/index.php?w=latin
Upvotes: 0
Reputation: 585
yes. some browsers and operating systems don't like it when you use the actual entity as it is... occasionally when typing a dash on a Mac it will just scramble or look like a void square on a Windows machine. its just safer to use the entity :D
Upvotes: -1