[html] HTML Table cellspacing or padding just top / bottom

Can you have cellpadding or spacing just on the top/ bottom as opposed to all (T, B, L, R) ?

This question is related to html html-table

The answer is


There is css:

table { border-spacing: 40px 10px; }

for 40px wide and 10px high


Cellspacing is all around the cell and cannot be changed (i.e. if it's set to one, there will be 1 pixel of space on all sides). Padding can be specified discreetly (e.g. padding-top, padding-bottom, padding-left, and padding-right; or padding: [top] [right] [bottom] [left];).


This might be a little better:

td {
  padding:2px 0;
}

There is css:

table { border-spacing: 40px 10px; }

for 40px wide and 10px high


Cellspacing is all around the cell and cannot be changed (i.e. if it's set to one, there will be 1 pixel of space on all sides). Padding can be specified discreetly (e.g. padding-top, padding-bottom, padding-left, and padding-right; or padding: [top] [right] [bottom] [left];).


This might be a little better:

td {
  padding:2px 0;
}

Cellspacing is all around the cell and cannot be changed (i.e. if it's set to one, there will be 1 pixel of space on all sides). Padding can be specified discreetly (e.g. padding-top, padding-bottom, padding-left, and padding-right; or padding: [top] [right] [bottom] [left];).


Cellspacing is all around the cell and cannot be changed (i.e. if it's set to one, there will be 1 pixel of space on all sides). Padding can be specified discreetly (e.g. padding-top, padding-bottom, padding-left, and padding-right; or padding: [top] [right] [bottom] [left];).