火狐也不知道为什么,自己功能上,样式上面,都无法让其强制换行,这里用JS来实现火狐里面强制换行的方法。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>firefox-break-word</title> <style type="text/css"> <!--/*--><![CDATA[/*><!--*/ #break {border:1px solid #ccc;padding:.4em .8em;width:200px;word-wrap:break-word;word-break:break-all;} /*]]>*/--> </style> </head> <body> <div id="break"> If there were less sympathy in the world, there would be less trouble in the world. ( O. Wilde ) </div> <script> function toBreakWord(intLen){ var obj=document.getElementById("ff"); var strContent=obj.innerHTML; var strTemp=""; while(strContent.length>intLen){ strTemp+=strContent.substr(0,intLen)+"<br>"; strContent=strContent.substr(intLen,strContent.length); } strTemp+="<br>"+strContent; obj.innerHTML=strTemp; } if(document.getElementById && !document.all) toBreakWord(37) </script> </body> </html>
提示:你可以先修改部分代码再运行。
还没有任何评论。
这篇文章上的评论的 RSS feed TrackBack URL
名称 (必填)
电子邮件 (不会被公开) (必填)
网站
Powered by WordPress