0

I read How to make div not larger than its contents?, but don't understand, can it work in IE7? I've tried this, but it doesn't work. For other browsers it works. I need header be the same width as content.

<!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>
Community
  • 1
  • 1
Valentina Chumak
  • 279
  • 6
  • 17
  • just wondering the reason to support an ancient browser... – Prashank Jul 02 '14 at 06:53
  • Internet Explorer used to have* a problem with `inline-block`, in that it could only apply it to elements that were 'naturally' `display: inline`. You could, perhaps, `float` it to achieve the same effect? [Source: Quirksmode](http://www.quirksmode.org/css/css2/display.html#t03). – David Thomas Jul 02 '14 at 06:53
  • this might help? http://stackoverflow.com/questions/6544852/ie7-does-not-understand-display-inline-block – Prashank Jul 02 '14 at 06:54
  • @DavidThomas I've already have hack with "*display: inline; zoom: 1;" from http://stackoverflow.com/questions/6544852/ie7-does-not-understand-display-inline-block but it doesn't help – Valentina Chumak Jul 02 '14 at 07:00
  • Could you please explain *how* it "didn't help"? In what way is your CSS broken? Does it do anything? – David Thomas Jul 02 '14 at 07:01
  • @DavidThomas in ie7 header width equals window width, while content width is more than window width. While I need header be the same width as content. – Valentina Chumak Jul 02 '14 at 07:06

0 Answers0