Chrome无法正常显示文字

时间:2011-06-05 16:36:06

标签: html css google-chrome

有关为什么此代码在Firefox中完美运行的任何想法(即,如果文本长于下面继续的宽度),但在Chrome中它不起作用? (例如文本一直向右)

CSS:

#leftnav {
 width: 18%;
 float: left;
 background-color: #fff;
 margin: 15px 0 0 0;
 margin-left: 5px;
 border: 1px solid #ddd;
 padding: 5px 5px 30px 5px;
 -moz-border-radius: 7px;
 -webkit-border-radius: 7px;
}
#leftnav h2 {
 font: normal 17px "Geneva", Helvetica, Arial, Tahoma, Verdana;
 letter-spacing: 0px;
 color: #ff4800;
 margin: 20px 0 5px 10px;
}

PHP / HTML:

<h2>
<a href="index.php?site=<?php echo urlencode($value);?>"><?php echo $value;?></a>
</h2>

非常感谢你的任何输入!

1 个答案:

答案 0 :(得分:0)

使用word-wrap: break-word

#leftnav h2 {
 font: normal 17px "Geneva", Helvetica, Arial, Tahoma, Verdana;
 letter-spacing: 0px;
 color: #ff4800;
 margin: 20px 0 5px 10px;
 word-wrap: break-word;
}

http://jsfiddle.net/7nruR/2/

http://webdesignerwall.com/tutorials/word-wrap-force-text-to-wrap