文字超出段落css html

时间:2011-03-09 19:39:09

标签: html css

我在段落中有文字

      <p style="width:200px;">Text goes here</p>

我的问题是,当文本增长(更大的宽度)时,它不会进入新的live.It走出段落。如果文本增长,我如何管理文本在新行中继续。< / p>

提前致谢。

7 个答案:

答案 0 :(得分:4)

我相信这不仅仅是那个p标签。我建议您查看网站的css,看看是否有更改overflowword-wrap属性的内容。

http://www.css3.com/css-word-wrap/

http://www.css3.com/css-overflow/

答案 1 :(得分:2)

删除p标签上的宽度。

<p>Text goes here.</p>

如果无法删除宽度,请尝试添加空白属性

<p style="width:200px;white-space:pre;>Lot's of text here that will be wider than 200px</p>

答案 2 :(得分:1)

默认情况下,overflow是auto,应该让它转到下一行。也许你设置的其他地方overflow: hidden;这就是为什么它这样做。尝试再次设置overflow:auto

答案 3 :(得分:0)

添加

  

空白:包装;

风格。这应该可以解决问题。

答案 4 :(得分:0)

你需要使用CSS3:word-wrap:break-word; 因为如果你在段落中有一个长词,它将永远离开元素,例如:try

<p style="width:100px;"> loremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsum </p> 
<p style="width:100px; word-wrap:break-word;"> loremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsum </p> 

溢出会使文本不可见。

答案 5 :(得分:0)

添加

overflow-wrap: break-word;

到CSS

答案 6 :(得分:-1)

因为HTML中的几乎所有元素都是框,所以你可以将“p标签”固定到它的div中,就像这样

<p style="position:relative; width:95%; height:whatever%;" > content </p>

您还可以通过使用“css left or right”属性定位框来实现文本缩进。

<p style="position:relative; width:95%; height:whatever%; left:20px;" > content </p>

注意:在定位任何框之前不要忘记“css position property”。

相关问题