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
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.
精彩评论