1

Possible Duplicate:
html, css - weird invisible margin below pictures

I'm working on this site: https://dl.dropbox.com/u/2241201/tivoli-animation/index.html

It's just a table with a bunch of <td><img src='' /></td>

I've set the width and height, but I don't know where that weird white space is coming from. I also know the images are the correct size, and there doesn't seem to be any padding or margin issues here when I inspect element in chrome.

4

3 回答 3

7

发生这种情况是因为您的图像默认情况下是内联的,所以基本上它们就像文本一样,在基线下留下空间。您可以使用block以下方法制作它们:

table img {
    display: block;
}

您可以在此处阅读更多相关信息:图像、表格和神秘差距 - MDN 上

于 2012-08-23T02:11:29.857 回答
1

尝试将 DOCTYPE 部分更改为:

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

你也可以检查这个: http ://www.emailonacid.com/blog/details/C18/12_fixes_for_the_image_spacing_in_html_emails

于 2012-08-23T02:49:35.803 回答
0

我不会尝试教您正确的 html 网页设计,但表格实体并不像您使用它那样用于页面组织。查看这些幻灯片以了解正确的浮动/定位、页面部分和 html 框模型。

http://www.cs.washington.edu/education/courses/cse190m/12su/lectures/slides/lecture05-float.shtml#

于 2012-08-23T02:31:03.163 回答