Matthew Knott

Previous: Starting Something BIG
Next: Solid

The importance of !DOCTYPE

Posted on Wednesday, 09 July 2008 09:56

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.

Comments

No comments have been added.

Add a comment