tag making browsers close paragraphs

前端 未结 3 1457
予麋鹿
予麋鹿 2021-01-18 13:27

I\'m having an issue with the HTML below:


  
    

Some paragraph text

相关标签:
3条回答
  • 2021-01-18 13:56

    Get rid of the pre tag altogether, and just give your span style="white-space:pre". See this page for a description of other white-space options.

    <pre> is basically saying <div style="white-space:pre">; what you want is <span style="white-space:pre">.

    0 讨论(0)
  • 2021-01-18 13:58

    Paragraph tags cannot contain block-level elements:

    http://www.w3.org/TR/html401/struct/text.html#h-9.3.1

    pre is a block level element.

    You could instead set the CSS style white-space: pre on your span if you desired to have pre-like behavior in an inline element.

    0 讨论(0)
  • 2021-01-18 14:16

    pre is a block level element, it isn't allowed to be inside a span if memory serves right.

    You can find out by validating your HTML.

    0 讨论(0)
提交回复
热议问题