如何在不带br的html中换行 [英] how to make line break in html without br

查看:38
本文介绍了如何在不带br的html中换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多内容,我将其上载到我的网站,并且在网站中看起来没有换行符.并且需要花费很多时间来添加内容-< br> .还有其他折线方法吗?谢谢!

i have a lot of content and i am going to upload it to my website, and in website it will look like with no line breaks. and it will take a lot of time to add in content - <br>. Is there any other way to break lines? Thank you!

推荐答案

我假设您的原始内容因回车符或换行符而出现中断,但在HTML中并未以这种方式呈现.

I'll assume your original content has breaks caused by carriage returns or line feeds, but they're not rendered that way in your HTML.

要解决此问题,请添加CSS样式预包装:

To fix that, add CSS style pre-wrap:

div {
  white-space: pre-wrap;
}

<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.  Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>

这篇关于如何在不带br的html中换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆