Nest lists in paragraphs in html

后端 未结 5 2084
长情又很酷
长情又很酷 2020-12-11 15:57

It seems that (strict) html doesn\'t allow nesting any non-inline elements inside a

, but then how am I supposed to render a paragraph that contains a

5条回答
  •  旧巷少年郎
    2020-12-11 16:10

    I suppose it depends on what you consider to be a "paragraph". It is obvious to me that the designers of HTML in no way consider a list to be part of a paragraph. And while I think an argument could be made for either interpretation, I'm of the opinion that the spec is correct.

    While a list doesn't represent a break in line of thought, it certainly represents a change in voice or method of thought, which I believe merits a new semantic container.

    In the same vein, a paragraph represents a logical partition in a piece of writing. A list represents a sequence of logical partitions, and while it is imaginable that one logical partition may be then divided into more partitions, it makes more sense to simply create a new partition (especially for such a large break in the voice/method).

    Semantics can be largely subjective. And that's fine. However, in this case, I'm of the opinion that the HTML spec correctly represents the semantics.

提交回复
热议问题