Html p 标签中的文本不会换行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18412487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:31:24  来源:igfitidea点击:

Text in p tag is not breaking to new lines

htmlcss

提问by Jan

Please have a look at the following image:

请看下图:

enter image description here

在此处输入图片说明

And here is the code with the problem:

这是有问题的代码:

<div class="excerpt">
 <p>Manual para la descarga e instalación de los contenidos digitales del Proyecto Canaima&nbsp;Educativo,&nbsp;conformado&nbsp;por&nbsp;recursos&nbsp;de&nbsp;aprendizaje&nbsp;que&nbsp;buscan&nbsp;impulsar&nbsp;la&nbsp;interacción&nbsp;entre&nbsp;el[...]</p>
</div>

For some bizarre reason the text is getting on top of the columns to the right. I tried changing the height of all of the elements taking part to 1000px, and they are STILL overlapping!

由于某些奇怪的原因,文本位于右侧的列顶部。我尝试将参与的所有元素的高度更改为 1000 像素,但它们仍然重叠!

EDIT: Question had a link originally so now that it was succesfully answered I changed it with an image per @Roddy of the Frozen Peas suggested.

编辑:问题最初有一个链接,所以现在它已成功回答,我根据 Frozen Peas 的 @Roddy 建议的图片更改了它。

As some people suggested, if you remove the & nbsp; the problem goes away. But that was not the case as it looks like the admin was inserting those & nbsp; and I have no saying in changing the admin. So the accepted answer finally solved it.

正如一些人所建议的,如果您删除   问题就解决了。但事实并非如此,因为看起来管理员正在插入那些   我在更改管理员方面没有发言权。所以接受的答案终于解决了它。

回答by MackieeE

Use: word-wrap: break-word;on your paragraph elements. That'll then start forcing them to start a new line.

使用:word-wrap: break-word;在您的段落元素上。这将开始迫使他们开始新的一行。

.entry-footer .excerpt p {
   word-wrap: break-word;
}

See firefox word-wrap documentation.

请参阅firefox 自动换行文档

回答by Kevin Lynch

There is a lot of white space being generated withing your html. add this to your CSS

您的html. 将此添加到您的 CSS

div.excerpt p {
    word-wrap: break-word;
}