Seemingly simple, but I cannot find anything relevant on the web.
What is the correct html code for an apostrophe? Is it a ’
?
Seemingly simple, but I cannot find anything relevant on the web.
What is the correct html code for an apostrophe? Is it a ’
?
Here is a great reference for HTML Ascii codes:
http://www.ascii.cl/htmlcodes.htm
The code you are looking for is: '
Depends on which apostrophe you are talking about: there’s '
, ‘
, ’
and probably numerous other ones, depending on the context and the language you’re intending to write. And with a declared character encoding of e.g. UTF-8 you can also write them directly into your HTML: '
, ‘
, ’
.
Use '
for a straight apostrophe. This tends to be more readable than the numeric '
(if others are ever likely to read the HTML directly).
Edit: msanders points out that '
isn't valid HTML4, which I didn't know, so follow most other answers and use '
.
A nice reference to characters, typography and HTML is found at A list Apart. According to that article, the correct HTML to apostrophe is ’
.
Firstly, it would appear that ' should be avoided - The curse of '
Secondly, if there is ever any chance that you're going to generate markup to be returned via AJAX calls, you should avoid the entity names (As not all of the HTML entities are valid in XML) and use the &#XXXX; syntax instead.
Failure to do so may result in the markup being considered as invalid XML.
The entity that is most likely to be affected by this is , which should be replaced by