unordered list in a paragraph element

前端 未结 4 526
囚心锁ツ
囚心锁ツ 2020-12-15 15:37

when I write this:

the list:

  • item

my browser is

4条回答
  •  独厮守ぢ
    2020-12-15 16:31

    Lists aren't allowed in paragraphs - there's no way to do it, it's semantically impossible.

    If you want the list to inherit styles from the paragraph, just add the UL element to the same CSS styles as your P elements:

    eg:

    p, ul { font-size: 12px; }
    

    or better yet, encase both elements in something logical (section, article, div).

    You've got to ask yourself why you want the list inside the paragraph. If it's because you want them styled the same, then you want them both in the same containing element, eg:

    Paragraph of text

    • List

    Next paragraph

    and then style the article.

提交回复
热议问题