开发者

How can I get a long text fit in a smaller DIV, wrapping itself in a new line if necessary?

I can make the text fit inside the div?

<div>
 Hello! This a long text, but I'd like it to fit the div's width
</div>

So far, I'开发者_如何学编程ve used max-width:100px, expecting the text to be wrapped to a new line. But, what I've gotten so far is a long text appearing above its containet and overfilling other containers.

It's looks like, just using max-width, is not enough.

Thanks for helping


If you're using &nbsp; characters instead of spaces, the line will overflow.

Also, check if the white-space attribute is set to "normal" and not "nowrap".


width:100px; should do it, depending on what other properties are set on the div.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜