Skip to content

Tip: Whitespace problems in IE7? One quick fix.

We all know and love the child selector hack to use one set of margins in IE6 and one set in Firefox. Naturally, IE7 came along and broke it!

If you define your margins properly and they still have extra whitespace in IE7, check to see if you are using the XHTML Transitional DTD.

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

If you are, switch to the XHTML Strict DTD:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

Of course, you will have to update your XHTML code to adhere to the strict standard (and there are some projects where this may not be possible or reasonable). It’s like taking your vitamins!

Make sure to also check out the IE7 blog for the section on conditional comments. This is like a philosophical return to the 1990s, but some projects call for drastic measures.

Related posts

Post a Comment

Your email is never published nor shared. Required fields are marked *