Debugging CSS
Debugging the page for Internet Explorer

The page that we use as an example was posted in a help forum, its author wanted to find why the content was pushed down with Internet Explorer.

As HTML is valid as well as CSS we can debug the page.

It has been reduced to a test case, the image has been changed and three versions can be displayed here:

We have:

The screenshot below shows the differences between browsers.

Editing for Firefox

The missing image

Internet Explorer wrongly encloses floated content and we have to enclose it for compliant browsers. Therefore we add display:table; or overflow:hidden; with Web Developer Toolbar. The image appears.

Web Developer Toolbar

The width

We remove width in #content with Web Developer Toolbar and the content is where we expected.

Web Developer Toolbar

We check with Internet Explorer.

The content

Removing the width moved the content at the right of the navigation bar.

Using padding for the paragraphs is risky as it implies rules for the other tags we may use. Using padding for #content will be safer and will mean less code.

Web Developer Toolbar

Setting margins for the first paragraph will improve the display. Thus we add #content p.first{margin-top:5px;}.

Our final display will be almost the same with recent browsers.

final display