Seemingly simple, but I cannot find anything relevant on the web.
What is the correct HTML code for an apostrophe? Is it ’
?
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 '
.
Sorry if this offends anyone, but there is a reasonable article on Ted Clancy's blog that argues against the Unicode committee's recommendation to use ’ (RIGHT SINGLE QUOTATION MARK) and proposes using U+02BC (MODIFIER LETTER APOSTROPHE) (aka ʼ or ʼ) instead.
In a nutshell, the article argues that:
It's '
.
As noted by msanders, this is actually XML and XHTML but not defined in HTML4, so I guess use the '
in that case. I stand corrected.
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: '
, ‘
, ’
.
You can try '
as seen in http://unicodinator.com/#0027
I've found FileFormat.info's Unicode Character Search to be most helpful in finding exact character codes.
Entering simply '
(the character to the left of the return key on my US Mac keyboard) into their search yields several results of various curls and languages.
I would presume the original question was asking for the typographically correct U+02BC ʼ, rather than the typewriter fascimile U+0027 '.
The W3C recommends hex codes for HTML entities (see below). For U+02BC that would be ʼ
, rather than '
for U+0027.
http://www.w3.org/International/questions/qa-escapes
Using character escapes in markup and CSS
Hex vs. decimal. Typically when the Unicode Standard refers to or lists characters it does so using a hexadecimal value. … Given the prevalence of this convention, it is often useful, though not required, to use hexadecimal numeric values in escapes rather than decimal values…
http://www.w3.org/TR/html4/charset.html
5 HTML Document Representation … 5.4 Undisplayable characters
…If missing characters are presented using their numeric representation, use the hexadecimal (not decimal) form, since this is the form used in character set standards.