开发者

arbitrary word wrap in IE

Firefox wraps text inside spans and divs neatly without expanding them. I'm having trouble achievin开发者_StackOverflow中文版g this with IE. IE only wraps words at word separators like spaces or hyphens. If the text does not contain spaces or hyphens the span expands in width. How do I get it to wrap arbitrarily and maintain the width of the span (or div) ?


Try the word-wrap property:

word-wrap: break-word;
-ms-word-wrap: break-word;


IE requires a special property.

If JQuery is an option for you try the jQuery word wrap plugin


Try something like this:

<P STYLE="word-wrap: break-word; -ms-word-wrap: break-word; width:100%;left:0">
LongWordLongWord...LongWordLongWord</P>

Taken from -ms-word-wrap Attribute Edited a bit.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜