John John - 1 year ago 86
CSS Question

HTML CSS Padding-bottom 0 does not work on firefox

I have a table as follow:

<td rowspan="2">
<td rowspan="3">


<td colspan="2">

The first cell of the first row, has a padding at the bottom. Well it's not really padding but it looks like padding and using firebug I can not find what the space there actually is.

I think what is happening is that, firefox automatically adjusts the bottom padding of the first td in the first tr with the padding top of the first and only td of the second tr.

p.s. works perfectly fine in Chrome.

Basically what I am trying to achieve is for the height of the first td in the first tr, to be only as tall as required but not taller so that the content of that cell ends on the same place as where the td ends without any space between them.

The website URL is:

It seems to have something to do with the padding-top placed on the first TD of the SECOND TR. The weird thing is that it works nicely on chrome.

Answer Source

if you are referring to the space in between the "Monthly poll" and "Monthly Magazine" boxes, it is not caused by padding...

What's happening is the td containing the flash video is too tall, and because it has a rowspan of 2, the two tds on the left are being adjusted to the height of the tallest td (aka the video box)

One solution is to add another tr below the first 2 rows,
let it have an empty td,
change the rowspan of the video box to 3

And then the redundant space you see in between the first 2 boxes will be transfered to the empty td you have just created.


I would suggest you bite the bullet and start using CSS rather than tables for layout, purely because:

  1. We are in the second decade of the 21st century
  2. It is much more flexible to use CSS
  3. It will be much easier for you change the look of the site in th future, without touching the markup.
  4. It will be much better for search engines to index your site content
  5. Assistive software such as screen readers can see your content in the order they are supposed to be seen
  6. You will be one happy developer in the end
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download