Correct use of Blockquote, q and cite?

前端 未结 6 589
半阙折子戏
半阙折子戏 2020-12-13 03:45

Is this the correct use of Blockquote, q and cite?

Type HTML in the textarea above,
6条回答
  •  一生所求
    2020-12-13 04:10

    Yes. They are not presentational elements — blockquote represents a block quotation, q represents an inline quotation, and cite represents a reference to a name, work, standard, URL, etc.

    You do have some validation errors that are fairly common with blockquote. A blockquote element cannot be inside a paragraph, and in HTML4 actually needs to contain paragraphs. The nesting of the p and blockquote elements in your fragment needs to be reversed.

    The blockquote element (also the q element) can optionally have a cite attribute to specify a URI where the quote came from. HTML5 says user agents should make that link available to the user, and HTML4 doesn't say anything at all. I would include the URI both in the cite attribute and as an inline link, since browsers don't handle it.

    Here's how I would write that fragment, with those revisions in mind:

    Type HTML in the textarea above, and it will magically appear in the frame below.

    reference url

    Validate this fragment

提交回复
热议问题