html - 表中的间距

标签 html css html-table spacing

我正在尝试用 html 设置表格。以下是部分截图。

Screenshot

如您所见,图像和下面的单元格之间有一条水平的白色 strip ,我无法摆脱它。我尝试了以下方法(我知道有点奥特 - 但我感到很沮丧!)

<table style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; ">
    <tr style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; ">
        <td width="200px" height="175px"  style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; "> 
            <img src="img" style="display: block; padding: 0; border: 0;" /> 
        </td>
    </tr>
    <tr style="text-align: center; border: 0; background-color: #ffffff; padding: 0; margin: 0; border-collapse: collapse; ">
        <td width="200px" height="25px"  style="text-align: center; border: 0; background-color: #535152; color: #fffdfe; padding: 0; margin: 0; border-collapse: collapse; ">
            Text
        </td>
    </tr>
</table>

这是基于我所拥有的 - 只是更简单。关于如何消除该差距的任何想法?

最佳答案

添加

vertical-align: top;

到图片的元素样式。这是因为图像被视为文本,因此 line-height 和 font-size 也会生效。

关于html - 表中的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23621775/

相关文章:

javascript - 使用链接 chop html 中的文本以显示更多/更少并将元素保留在内部

html - 绝对位置使其他内容元素不灵活

html - 如何在 html 表格中获得连续的顶部和底部边框

html - 响应图像(宽度和高度)

html - 如何创建带有固定标题的滚动表

python - 使用 python 从文本文件创建动态 HTML 页面

javascript - 实际 URL 在 php 中打开重定向页面

html - 如何在容器中 float 4 个响应式 div?

html - CSS 全屏背景

html - 来自父级的子主题 style.css 不传输