This site is a low down on what's going on in my life, what I'm working on, what I'm thinking about, and how I'm feeling about life in general.

Wednesday, 09 July 2008 09:56

The importance of !DOCTYPE

Messing around with a bit of code, I was trying to do a quick floating window to receive some ajax-built content. This was just a quickie proof of concept thing rather than anything serious.

Anyway, the div was all over the place in IE7 compared to Firefox, and it had issues with elements showing from behind the div.

I racked my brain for hours, setting the z-index, trying this, that and the other. In the end, I added a simple:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

After this, things started working! I couldn't believe that something so simple would affect my CSS so drastically, so let that be a warning to you.



Posted in categories:

Tags: css Doctype Div Positioning Absolute Relative

Comments

    Add a comment