开发者

Regex with long HTML strings and <wbr>

I just found the <wbr> element (link) which basically lets specific an area where a break could apply if needed.

Basically I'd like to implement it in my apps, to prevent breaking the layout due a comment in a blog with too ma开发者_Python百科ny letters or signs.

The problem is: it has to be HTML compatible, so averylongmadeupandunnecesaryunspacedword might break apart each 25 characters but it won't break a link <a href="http://www.google.com/search?hl=en&source=hp&q=averylongandunnecesarywordingoogle&aq=f&aql=&aqi=&oq=">link</a>.


Have you considered using CSS? The word-wrap property is supported in IE, Safari, and FireFox 3.5

/* example */
.comments { word-wrap: break-word }

Also, <wbr> isn't supported on IE8 :(

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜