如果“content”包含没有空格的长字符串,它将溢出div(“topic”)。 我怎么能解决这个问题?
现场演示在这里:http://jsfiddle.net/w87Vz/
HTML:
<div class="topic">
<div class="content">a longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong string</div>
</div>
的CSS:
.topic{
background:#ddd;
margin: 0 auto;
position: relative;
display: block;
width: 300px;
}
答案 0 :(得分:7)
在你的风格中添加:
自动换行:break-word;