How to Code Double Quotes via HTML Codes

后端 未结 3 909
我寻月下人不归
我寻月下人不归 2020-12-29 18:38

In HTML, What is the preferred way to specify html codes like \", and what is the major differences? For example:



        
相关标签:
3条回答
  • 2020-12-29 19:26

    Google recommend that you don't use any of them, source.

    There is no need to use entity references like &mdash, &rdquo, or &#x263a, assuming the same encoding (UTF-8) is used for files and editors as well as among teams.

    Is there a reason you can't simply use "?

    0 讨论(0)
  • 2020-12-29 19:31

    There really aren't any differences.

    " is processed as " which is the decimal equivalent of &x22; which is the ISO 8859-1 equivalent of ".

    The only reason you may be against using " is because it was mistakenly omitted from the HTML 3.2 specification.

    Otherwise it all boils down to personal preference.

    0 讨论(0)
  • 2020-12-29 19:37

    There is no difference, in browsers that you can find in the wild these days (that is, excluding things like Netscape 1 that you might find in a museum). There is no reason to suspect that any of them would be deprecated ever, especially since they are all valid in XML, in HTML 4.01, and in HTML5 CR.

    There is no reason to use any of them, as opposite to using the Ascii quotation mark (") directly, except in the very special case where you have an attribute value enclosed in such marks and you would like to use the mark inside the value (e.g., title="Hello "world""), and even then, there are almost always better options (like title='Hello "word"' or title="Hello “word”".

    If you want to use “smart” quotation marks instead, then it’s a different question, and none of the constructs has anything to do with them. Some people expect notations like " to produce “smart” quotes, but it is easy to see that they don’t; the notations unambiguously denote the Ascii quote ("), as used in computer languages.

    0 讨论(0)
提交回复
热议问题