使Div宽度等于IE7的子内容

时间:2014-07-02 06:52:14

标签: html css internet-explorer internet-explorer-7 width

我看了How to make div not larger than its contents?,但不明白,它可以在IE7中运行吗?我试过这个,但它没有用。适用于其他浏览器。 我需要标题与内容的宽度相同。

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        #innerdiv {
            display: inline-block;
            *display: inline;
            zoom: 1;
        }
        #header {
            border: 1px solid #000000;
        }
        #content {
            border: 1px solid #008000;
        }
    </style>
</head>
<body>
    <div id="innerdiv">
        <table id="header" width="100%">
            <tr>
                <td>
                    <div style="width:400px; height:50px"></div>
                </td>
            </tr>
        </table>
        <table id="content" width="100%">
            <tr>
                <td>
                    <div style="width:1380px; height:50px"></div></td>
            </tr>
        </table>
    </div>
</body>
</html>

0 个答案:

没有答案
相关问题