Resolving gaps and spaces in table cells when using the HTML 5 doctype
Filed under: web development
comments (17) Views: 40,232
While building an HTML email for Goba (new site coming soon) I decided to use tables for layout rather than pure CSS; sadly the dizzying array of email clients make tables a far more reliable medium for this sort of thing. Into one cell I placed an image to be used as the top section of a rounded corner box. It looked great in every browser that I used to preview the email, but when I sent it out and checked it in GMail, there were mysterious spaces around each cell whose only contents were images. In my case, there were 4 of them.
After trying Firebug I turned to the internet where I learned that the HTML 5 doctype, used by Gmail, adds some mysterious spacing inside table cells when their only contents are inline elements. Turns out that the fix is to convert the inline element to a block level element with CSS. Here's an example with no doctype, and borders on the table turned on. To see the issue, remove the style attribute from the top and bottom image. Hope this helps someone else.
If this article was interesting, or helpful, or even wrong, please consider leaving a comment, or buying something from my wishlist. It's appreciated!coach outlet online jordan 13 grey toe beats by dre cyber monday michael kors black friday beats by dre cyber monday jordan 6 black infrared north face cyber monday michael kors cyber monday north face black friday coach outlet black infrared 23 13s north face cyber monday jordan 6 black infrared north face black friday coach cyber monday jordan 11 legend blue north face cyber monday black infrared 6s lebron 12 north face black friday jordan 11 legend blue louis vuitton outlet jordan 13 grey toe grey toe 13s beats by dre black friday coach black friday jordan 13 grey toe coach cyber monday uggs black friday jordan 13 black infrared 23 uggs cyber monday barons 13s uggs black friday beats by dre cyber monday black infrared 6s jordan 13 bred jordan 13 black infrared 23 north face black friday black infrared 6s jordan 11 legend blue michael kors black friday jordan 13 grey toe coach black friday michael kors black friday michael kors cyber monday beats by dre cyber Monday north face cyber monday coach black friday michael kors cyber monday beats by dre cyber Monday north face black friday beats by dre black friday lululemon black friday uggs black friday jordan 13 bred coach cyber monday beats by dre black friday uggs black friday coach black friday black infrared 6s