new line without
tag

后端 未结 4 1474
被撕碎了的回忆
被撕碎了的回忆 2021-02-07 00:46

Writing this html:

lorem ipsum
lorem ipsum
lorem ipsum

browser shows:

lorem ipsumlorem ipsumlorem ipsum

Is th

4条回答
  •  感情败类
    2021-02-07 01:04

    You can use the

     tag to keep the line breaks.

    lorem ipsum
    lorem ipsum
    lorem ipsum
    

    The default style for pre tags is monospaced font, but that can be overriden.

    You can achieve the same effect without any extra default formatting using the white-space: pre CSS property.

    lorem ipsum lorem ipsum lorem ipsum

    There are several other values for white-space, but you should refer to the documentation to choose the most fitting one.

    Note that pre will treat every line break the same including the one following the

     or 
    tags. If you don't want them you will need to do:

    lorem ipsum lorem ipsum ...

提交回复
热议问题