//以下代码在firefox和ie6或7下的显示效果不一致,怎么解决<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<div style="background-color:#EEE;padding:5px;border:1px solid">
<input type="button" value="我是按钮" />
    <span style="float:right">aaabbbccc</span>
</div>
</body>
</html>

解决方案 »

  1.   

    <!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=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    html,body{margin:0;padding:0;}
    span{font-size:16px;}
    </style>
    </head>
    <body>
    <div style="background-color:#EEE;border:1px solid #ccc">
    <input type="button" value="我是按钮" style="margin:5px;" />
      <span style="float:right;">aaabbbccc</span>
    </div>
    </body>
    </html>
      

  2.   

    这个是盒子模型的问题,IE和firefox所用的盒子模型不同,你可以像一楼那样把样式写出来标准的W3C盒子要不IE盒子大点
      

  3.   

    +++
    猛一点就用 * {padding:0;margin:0}
      

  4.   

    首先,你的写法就不正确:
    <input type="button" value="我是按钮" />

    <span></span>
    都是行内元素,但是对于行内元素加了浮动的话,等于是把这个行内元素加了一个:display:block,的属性,
    既然是display:block了,那这个元素肯定是块级别元素,所以你的写法是不符合w3c标准的。提醒一点:就是有浮动的元素,最好是在跟他同一级别的地方清除浮动,即加<div style="clear:both"></div> 否则的话用div布局,如果页面比较复杂的话,那这个页面的兼容性应该就不咋地了,建议设计页面的时候最好少按照火狐的标准走,只要火狐的过了,其他的基本上没多大问题啦~
      

  5.   


    <!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=gb2312" />
    <title>无标题文档</title>
    </head>
    <body>
    <div style="float:left;background-color:#EEE;padding:5px;border:1px solid;width:100%">
    <input type="button" style="float:left" value="我是按钮"/>
      <span style="float:right">aaabbbccc</span>
    </div>
    </body>
    </html>