开发者

arbitrary word wrap in IE

开发者 https://www.devze.com 2022-12-31 05:05 出处:网络
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 hyph

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

精彩评论

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