这是我的CSS
.newsContent {
position: relative;
background-color: red;
min-height: 200px;
width: 300px;}
如何不绕过div的边界?
有一个新的 CSS3 属性可以满足您的需要。
word-wrap: break-word;
您所说的是overflow
div 元素的。
有关更多详细信息,请使用: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;
现在,如果您谈论的是文本中断,请查看其他答案。
一种方法是使用word-wrap: break-word;
on.newsContent
.newsContent {
position: relative;
background-color: red;
min-height: 200px;
width: 300px;
word-wrap: break-word;
}