> hi,
>
> I discovered recently, the hard way, that adding padding-right or
> padding-left to a <td> adds to the width of <td>!!
Yes, that's what it is supposed to do. Per the standards.
> so how do I add left- or right-padding to a <td> without adding to the
> width of it (short of putting a div inside each <td> and making it a
> specific width?)
I'm not sure what you are trying to do, but my guess is that you want to
increase the space between the cells without increasing the size of the
block which is affected by the background colour, background image, etc.
To do this you can specify (or increase) the TD's margin.
HTH
maya - 20 Feb 2008 20:21 GMT
>> hi,
>>
[quoted text clipped - 14 lines]
>
> HTH
td's margin? as in <td class="x">
.x {margin-right:10px} ???
this will add PADDING?????
I thought margin was for OUTSIDE ELEMENT (outside border whether visible
or not..), padding for INSIDE ELEMENT..
oh brother..
I have only one column in table, and need padding ONLY on the right...
thank you....
C A Upsdell - 20 Feb 2008 20:46 GMT
>>> hi,
>>>
[quoted text clipped - 21 lines]
>
> this will add PADDING?????
No, it sets a right margin. The CSS you cite will increase the spacing
to the right of the cell.
> I thought margin was for OUTSIDE ELEMENT (outside border whether visible
> or not..), padding for INSIDE ELEMENT..
Inside, outside, it is all semantics. The margin is a property of the
cell, so it might be considered inside, but the margin is not affected
by the border or the background colour, so it might be considered
outside too. It is just how you look at it.
Beauregard T. Shagnasty - 20 Feb 2008 21:30 GMT
> I have only one column in table, and need padding ONLY on the right...
Hmm, there is a question here somewhere...
(Ok ... why a table?)
<div class="needspace">
[content here]
</div>
.needspace { margin-right: 2em; }

Signature
-bts
-Friends don't let friends drive Vista
Ben C - 20 Feb 2008 21:51 GMT
[...]
>> so how do I add left- or right-padding to a <td> without adding to the
>> width of it (short of putting a div inside each <td> and making it a
[quoted text clipped - 5 lines]
>
> To do this you can specify (or increase) the TD's margin.
Margin properties don't apply to elements that are display: table-cell
(i.e. TDs usually).
If you want gaps between the cells you set border-spacing on the table
(or if you need support in IE use the cellspacing attribute instead).
Galaxy - 23 Feb 2008 08:30 GMT
> [...]
> >> so how do I add left- or right-padding to a <td> without adding to the
[quoted text clipped - 12 lines]
> If you want gaps between the cells you set border-spacing on the table
> (or if you need support in IE use the cellspacing attribute instead).
Yep yep. U wanna add:
border-collapse: separate;
But taht would make the col "gutter", not one cell.
In IE u can:
td#cell1{
position: relative;
left: 10px;
}
Moves the cell.
:DD
-G
GTalbot - 26 Feb 2008 05:29 GMT
> U wanna add:
>
> border-collapse: separate;
No need to; separate is the initial, default border-collapse value.
> In IE u can:
>
[quoted text clipped - 5 lines]
>
> Moves the cell.
Relatively positioning a table cell is not recommendable, not
required.
First of all, we don't even know the webpage context of the OP.
"Positioning and floating of table cells can cause them not to be
table cells anymore, according to the rules in section 9.7."
http://www.w3.org/TR/CSS21/tables.html#table-layout
"The effect of 'position:relative' on table-row-group, table-header-
group, table-footer-group, table-row, table-column-group, table-
column, table-cell, and table-caption elements is undefined."
http://www.w3.org/TR/CSS21/visuren.html#choose-position
Regards, Gérard
> hi,
>
> I discovered recently, the hard way, that adding padding-right or
> padding-left to a <td> adds to the width of <td>!!
This sounds like a box model issue. I'm not sure this applies to
tables cells but it does to other boxes.
Try taking this out of standards mode and see if that "fixes" your
problem. There is a CSS box setting but I don't believe it is widely
supported.
Others should come along and correct this. I'm not feeling well
today, so I did not verify this
Jeff
> so how do I add left- or right-padding to a <td> without adding to the
> width of it (short of putting a div inside each <td> and making it a
[quoted text clipped - 4 lines]
>
> thank you...