You are here:About>Computing & Technology>Web Design / HTML> About.com Web Design A to Z> Examples> Testing display:table; in Internet Explorer
About.comWeb Design / HTML

Testing display:table; in Internet Explorer

Internet Explorer 7 is a great improvement on the browser, with a lot of support. But one thing they didn't release was support for the display:table CSS property.

Below the ad you will see a table and a div. In Firefox, Opera, and Safari the two boxes display nearly identically (Since I didn't modify the cellspacing and cellpadding, they are a little different). But in Internet Explorer, the div takes up the full page, and the table takes up only the space it uses.

Table

When rendered, this box is exactly
as wide as it needs to be.
<table>
<tr>
<td style="background:#cfc;border:double #c8c 5px;padding:0 1em">
When rendered, this box is <em>exactly</em> <br/>as wide as it needs to be.
</td>
</tr>
</table>

Div

When rendered, this box is exactly
as wide as it needs to be.
<div style="background:#cfc;border:double #c8c 5px;padding:0 1em; display: table;">
When rendered, this box is <em>exactly</em> <br/>as wide as it needs to be.
</div>
Jennifer Kyrnin
From Jennifer Kyrnin,
Your Guide to Web Design / HTML.
FREE Newsletter. Sign Up Now!
Newsletters & RSSEmail to a friendSubmit to Digg
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.