How to line-break from css, without using
?

后端 未结 26 1128
攒了一身酷
攒了一身酷 2020-11-22 15:49

output:

hello
How are you

code:

hello
How are you

Ho

相关标签:
26条回答
  • 2020-11-22 16:44

    You can use white-space: pre; to make elements act like <pre>, which preserves newlines. Example:

    p {
      white-space: pre;
    }
    <p>hello 
    How are you</p>

    Note for IE that this only works in IE8+.

    0 讨论(0)
  • 2020-11-22 16:45

    At the CSS use the code

    p {
        white-space: pre-line;
    }
    

    With this code css every enter inside the P tag will be a break-line at the html.

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