解决办法:

使用CSS属性 word-wrap:break-word;即可解决。使用break-word时,是将强制换行。

break-word兼容各版本IE浏览器,兼容谷歌浏览器。

实例:

<!DOCTYPE html> 
<html  ns=\"http://www.w3.org/1999/xhtml\"> 
<head> 
<  http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> 
< >css 实现长英文或链接自动换行</ > 
<style> 
.box{ border:1px solid #00F; height:120px; width:200px;word-wrap:break-word} 
</style> 
</head> 
<body> 
<div class=\"box\"> 
aabbfjdlkfldsjfldsjfldjfljdlafjldsjflkdjflkdsjfldfjdlj<br /> 
  <a href=\"http://www.manongjc.com\">http://sddsdsddddddddddddddddddddddddddddddddddddddddd.com</a>
</div> 
</body> 
</html> 

在线运行

收藏 打印