HTML code for an apostrophe
HtmlAsciiHtml Problem Overview
Seemingly simple, but I cannot find anything relevant on the web.
What is the correct HTML code for an apostrophe? Is it ’
?
Html Solutions
Solution 1 - Html
If you are looking for straight apostrophe '
(U+00027), it is
'
or '
(latest is HTLM 5 only)
If you are looking for the curly apostrophe ’
(U+02019), then yes, it is
’
or ’
As of to know which one to use, there are great answers in the Graphic Design community: What’s the right character for an apostrophe?.
Solution 2 - Html
A List Apart has a nice reference on characters and typography in HTML. According to that article, the correct HTML entity for the apostrophe is ’
. Example use: ’ .
Solution 3 - Html
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.
Solution 4 - Html
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: '
, ‘
, ’
.
Solution 5 - Html
A standard-compliant, easy-to-remember set of html quotes, starting with the right single-quote which is normally used as an apostrophe:
- right single-quote —
’
— ’ - left single-quote —
‘
— ‘ - right double-quote —
”
— ” - left double-quote —
“
— “
Solution 6 - Html
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  
Solution 7 - Html
Here is a great reference for HTML Ascii codes:
http://www.ascii.cl/htmlcodes.htm
The code you are looking for is: '
Solution 8 - Html
Note that '
IS defined in HTML5, so for modern websites, I would advise using '
as it is much more readable than '
Check: http://www.w3.org/TR/html5/syntax.html#named-character-references
Solution 9 - Html
Even though '
reads nicer than '
and it's a shame not to use it, as a fail-safe, use '
.
'
is a valid HTML 5 entity, however it is not a valid HTML 4 entity.
Unless <!DOCTYPE html>
is at the top of your HTML document, use '
Solution 10 - Html
'
in decimal.
%27
in hex.
Solution 11 - Html
Although the '
entity may be supported in HTML5, it looks like a typewriter apostrophe. It looks nothing like a real curly apostrophe—which looks identical to an ending quotation mark: ’
.
Just look when I write them after each other:
1: right single quotation mark entity, 2: apostrophe entity: ’
'
.
I tried to find a proper entity or alt command specifically for a normal looking apostrophe (which again, looks ‘identical’ to a closing right single quotation mark), but I haven’t found one. I always need to insert a right single quotation mark in order to get the visually correct apostrophe.
If you use just ’
(ALT + 0146) or autoformat typewriter apostrophes and quotation marks as curly in a word processor like Word 2013, do use <meta charset="UTF-8">
.
Solution 12 - Html
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.
Solution 13 - Html
Just a one more link with nicely maintained collection Html Entities
Solution 14 - Html
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:
- A punctuation mark (such as a quotation mark) normally separates words and phrases, while the sides of a contraction really can't be separated and still make sense.
- Using a modifier allows one to select a contraction with the regular expression \w+
- It's easier to parse quotes embedded in text if there aren't quotation marks also appearing in contractions
Solution 15 - Html
As far as I know it is '
but it seems yours works as well
Solution 16 - 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 '
.
Solution 17 - Html
You can try '
as seen in http://unicodinator.com/#0027