3

这是我的CSS

.newsContent {
position: relative;
background-color: red;
min-height: 200px;
width: 300px;}

在此处输入图像描述

如何不绕过div的边界?

4

3 回答 3

4

有一个新的 CSS3 属性可以满足您的需要。

word-wrap: break-word;
于 2013-07-29T21:43:11.780 回答
3

您所说的是overflowdiv 元素的。

有关更多详细信息,请使用:http ://www.w3schools.com/cssref/pr_pos_overflow.asp

visible  |  The overflow is not clipped. It renders outside the element's box. (DEFAULT)
hidden   |  The overflow is clipped, and the rest of the content will be invisible
scroll   |  The overflow is clipped, but a scroll-bar is added to see the rest of the content
auto     |  If overflow is clipped, a scroll-bar should be added to see the rest of the content
inherit  |  Specifies that the value of the overflow property should be inherited from the parent element

如果你想切断它,使用overflow: hidden;

现在,如果您谈论的是文本中断,请查看其他答案。

于 2013-07-29T21:43:47.443 回答
2

一种方法是使用word-wrap: break-word;on.newsContent

.newsContent {
    position: relative;
    background-color: red;
    min-height: 200px;
    width: 300px;
    word-wrap: break-word;
 }

http://jsfiddle.net/wETGx/

于 2013-07-29T21:43:35.343 回答