Differences between and

2020-04-05 19:30发布

There are several articles about this topic but I'm not able to understand the relevant difference between <q> and <blockquote>. The spec seems to have changed for blockquote link. It seems that long quotations are reserved for blockquote and inline quotation for <q>.

What do they mean with inline quotations?

Does one need to have the name of an author?

For example: what if the quote is of a company and its one long sentence. I would use <q> but I would not know exactly how to defend that point with arguments.

4条回答
闹够了就滚
2楼-- · 2020-04-05 19:47

<blockquote> is block level element, normally it starts and end with new line when displayed in the browser. <q> is inline element,normally it displays without line break.

Block elements stand on their own; inline elements goes with the flow.

查看更多
一夜七次
3楼-- · 2020-04-05 20:01

<blockquote> is a block level element like div. Which means that it will start at a new line if you put it in a document flow. For example, if my markups are:

 Henry Ford said <blockquote>Most people spend more time and energy going around problems than in trying to solve them.</blockquote> in the 20th century

They will be shown on browsers like this blockquote Example

<q> is an inline element like span. So if my markups are

 Henry Ford said <q>Most people spend more time and energy going around problems than in trying to solve them.</q> in the 20th century

The result will be

q example

查看更多
来,给爷笑一个
4楼-- · 2020-04-05 20:01

is block level element, normally it starts and end with new line when displayed in the browser. is inline element,normally it displays without line break.

Block elements stand on their own; inline elements goes with the flow.

查看更多
家丑人穷心不美
5楼-- · 2020-04-05 20:13

Just see their definitions:

  • q element:

    […] some phrasing content quoted from another source

  • blockquote element:

    […] a section that is quoted from another source

The last part is the same ("quoted from another source"), so they only differ in "phrasing content" vs. "section".

q can only contain phrasing content (and it can only be used where such phrasing content is expected). blockquote can only contain flow content (and it can only be used where such flow content is expected). In that sense, they are similar to span (~ q) and div (~ blockquote).

Some other differences:

Note that blockquote is a sectioning root, which means that any headings or sectioning elements it may contain will not be part of the document’s outline. q can’t contain headings or sectioning elements in the first place.

Note that you MUST NOT use any quotation marks when using q (not before, not inside, not after), because user agents should add them automatically. There is no such restriction for blockquote (however, it’s probably unlikely that you’d need some for block quotes).

查看更多
登录 后发表回答