看起来很简单,但我在网上找不到任何相关的东西。
撇号的正确 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: ’ .
是'
。
正如 msanders 所指出的,这实际上是 XML 和 XHTML,但没有在 HTML4 中定义,所以我想'
在这种情况下使用。我站得更正了。
A standard-compliant, easy-to-remember set of html quotes, starting with the right single-quote which is normally used as an apostrophe:
’
— ’‘
— ‘”
— ”“
— “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  
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
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 '
'
in decimal.
%27
in hex.
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…</p>
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.
Just a one more link with nicely maintained collection Html Entities
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:
As far as I know it is '
but it seems yours works as well
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 '
.
You can try '
as seen in http://unicodinator.com/#0027