简单的div+css问题为什么在IE中和火狐中有不同的效果,谢谢解答!
下面是测试代码:
<style>
*{margin:0px}
#menu{width:950px; margin:0px auto;}
#menu ul {list-style:none;margin:0px; width:100%}
#menu ul li {float:left;margin:0px; text-align: center;}
#menu ul .leftimg {background:url(images/an_01.gif);width:2px;height:38px;}
#menu ul .rightimg {background:url(images/an_03.gif);width:2px;height:38px;}
#menu ul .li {background:url(images/an_04.gif);width:2px;height:38px;}
#menu ul li a{width:77px;float:left;margin:0px;background-image: url(images/an_02.gif);font-size: 14px;color: #FFFFFF;text-decoration: none;line-height: 38px;height: 38px;font-weight: bold;}
#menu ul li a:hover{float:left; margin:0px;10px;background-image: url(images/an_05.gif);font-size: 14px;color: #FFFFFF;text-decoration: none;line-height: 38px;height: 38px;font-weight: bold;}
</style>
<div id=menu> <ul> <li class=leftimg> </li> <li> <a href= "index.html "> index </a> </li> <li class=li> </li> <li> <a href= "List/8_1.html "> 001 </a> </li> <li class=li> </li> <li> <a href= "List/9_1.html "> 002 </a> </li> <li class=li> </li> <li> <a href= "List/10_1.html "> 003 </a> </li> <li class=li> </li> <li> <a href= "List/11_1.html "> 004 </a> </li> <li class=rightimg> </li>
</ul>
</div>
这是测试预览效果:
http://www.zjjotc.cn/divcss.html
现在这个测试地址在IE中可以正常显示
为什么放到火狐中menu层就向右移动了差不多20的像素呢,谢谢解答!
------解决方案--------------------#menu ul {list-style:none;margin:0px; width:100%;padding-left:0px;}