-1

HTML:

<div> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</div>

CSS:

div {
    width: 150px;
    border: 1px solid red
}

演示:http: //jsfiddle.net/B93XB/

问题:对此有什么解决方案?

4

2 回答 2

4

添加word-break:break-all

还添加display:inline-block

div {
    width: 150px;
    border: 1px solid red;
    background:red;
    word-break:break-all;
    display:inline-block
}

演示

于 2013-02-18T09:45:51.323 回答
0

你可以使用CSS3吗?如果是这样,试试这个:

word-wrap: break-word;

如此处所示:http: //jsfiddle.net/B93XB/2/

于 2013-02-18T09:46:14.633 回答