有关为什么此代码在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>
非常感谢你的任何输入!
答案 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://webdesignerwall.com/tutorials/word-wrap-force-text-to-wrap