Is the <q> tag same as adding double quotes manually in html?

对着背影说爱祢 提交于 2020-01-05 08:53:11

问题


I have recently started learning html from w3schools.com. In this example we can add double quotes to any text by using <q> tag around it. What I wonder is that we can simply add double quotes manually too, e.g.

<q>text quoted</q>

will render just same if we instead add double quotes manually

"text quoted"

  • Is there any differnce between these two methods to add double quotes?

回答1:


The difference is that when you use the <q> element the software reading the page (a browser, a search engine spider, etc) knows that it's a quotation and might have different processing rules for it: browsers might render it differently, in italics for example, or a different culture's quote symbols (Japan doesn't use quotes, they use right-angle symbols) and search engines could look-up the quote elsewhere and provide a citation. If you don't mark-up your text then none of these scenarios are possible.

This falls under the umbrella term "the semantic web" - it's about markup throughly describing its content's meaning, not just the way it looks.

Also, don't use W3Schools: they have a poor reputation for teaching only the absolute basics required to achieve and end-goal, often with nasty shortcuts and it instills bad habits. Instead I recommend resources like Mozilla Developer Network (MDN) when learning about the web.




回答2:


The q element represents some phrasing content quoted from another source. This means we can’t use <q> for sarcasm or other non-quotation uses of quote marks (“”). In those cases, add punctuation manually. The spec continues:

For More read the article

http://alistapart.com/article/qtag



来源:https://stackoverflow.com/questions/34987106/is-the-q-tag-same-as-adding-double-quotes-manually-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!