Remove spacing between table cells and rows

徘徊边缘 提交于 2019-12-02 18:43:44

It looks like the DOCTYPE is causing the image to display as an inline element. If I add display: block to the image, problem solved.

Add border-collapse: collapse into the style attribute value of the inner table element. You could alternatively add the attribute cellspacing=0 there, but then you would have a double border between the cells.

I.e.:

<table class="main-story-image" style="float: left; width: 180px; margin: 0 25px 25px 25px; border-collapse: collapse">

You have cellspacing="0" twice, try replacing the second one with cellpadding="0" instead.

I had a similar problem. This helps me across main email clients. Add:

  • attributes cellpadding="0", cellspacing="0" and border="0" to tables
  • style border-collapse: collapse; to tables
  • styles padding: 0; margin: 0; to each element
  • and styles font-size: 0px; line-height: 0px; to each element which is empty
drupal

Nothing has worked. The solution for the issue is.

<style>
table td {
    padding: 0;
}
</style>
Satish Upadhyay

Used font-size:0 in parent TD which has the image.

I had a similar problem and I solved it by (inline)styling the td element as follows :

<td style="display: block;"> 

This will work although its not the best practice. In my case I was working on a old template that had been styled using HTML tables.

Vijay Kumar

Hi as @andrew mentioned make cellpadding = 0, you still might have some space as you are using table border=1.

user2115923

Put display:block on the css for the cell, and valign="top" that should do the trick

If the caption box is gray then you can try wrapping the image and the caption in a div with the same background color of gray---so a "div" tag before the "tr" tag...This will mask the gap because instead of being white, it will be gray and look like part of the gray caption.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!