<!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>Dialog</title>
</head>
<body >
<div style="height:100px; width:100px; border:1px solid #000000; text-align:center">
       <div style=" height:30px; width:30px; border:1px solid #00FF00; display:inline-table"></div>
       <div style=" height:30px; width:30px; border:1px solid #00FF00; display:inline-table"></div>
</div>
</body>
</html>上面的在ie-6下不支持,
我希望的效果是ie6  ff下  如果有一个div居中,
如果是2个div并排居中   
不要用display:inline    在实际运用中  好象不行.................

解决方案 »

  1.   

    <div style=" height:30px; width:30px; border:1px solid #00FF00; float:inherit"></div>
    <div style=" height:30px; width:30px; border:1px solid #00FF00; float:inherit"></div>这个行吗?
      

  2.   

    zoom: 1;*display: inline;
    加上这个看看
      

  3.   

    <div style="height:100px; width:100px; border:1px solid #000000;">
        <div style="width:64px;height:30px; margin-left:auto;margin-right:auto;">
           <div style=" height:30px; width:30px; border:1px solid #00FF00; float:left">w</div>
           <div style=" height:30px; width:30px; border:1px solid #00FF00; float:left">w</div>
        </div>
    </div>
      

  4.   

    用个表装起来应该就可以了
        <div style="height: 100px; width: 100px; border: 1px solid #000000; text-align: center">
            <table>
                <tr>
                    <td>
            <div style="height: 30px; width: 30px; border: 1px solid #00FF00; display: inline-table">
            </div>
                    </td>
                    <td>
            <div style="height: 30px; width: 30px; border: 1px solid #00FF00; display:none">
            </div>
                    </td>
                </tr>
            </table>
        </div>
      

  5.   

    回 6楼
    不好  代码那么多  有没技术含量回 3楼
    这个不大好吧  2个可以 但是 1个就又要改宽度  3个又要改宽度  很不爽啊  回cloudgamer
    解决了  谢谢<!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>Dialog</title>
    </head>
    <body>
    <div style="height:100px; width:100px; border:1px solid #000000; text-align:center; ">
          <div style=" height:30px; width:30px; border:1px solid #00FF00;  zoom:1; display:inline-block !important; *display:inline; ">1</div>
          <div style=" height:30px; width:30px; border:1px solid #00FF00; zoom:1;display:inline-block !important; *display:inline;">2</div>
    </div>
    </body>
    </html>