How to put some space at the left margin of a table cell?

M

Martin

In some cases, I want to space the data in a table cell over a little
bit (have some white space between the left cell border and the text).
But ONLY on the left side - not at the top and bottom. If I set the
"padding", it enlarges the entire cell - I don't want that.

I generally do this by inserting several " " before the cell text
when I generate the table. This accomplishes what I want but is this
the "best" way?

One case in which the   does not work very well is when the cell
text is a "hot link" (an href anchor tag); then the  's are
underlined and it doesn't look good.

Any thoughts?

Thanks
 
A

Adrienne Boswell

Martin said:
In some cases, I want to space the data in a table cell over a little
bit (have some white space between the left cell border and the text).
But ONLY on the left side - not at the top and bottom. If I set the
"padding", it enlarges the entire cell - I don't want that.

I generally do this by inserting several " " before the cell text
when I generate the table. This accomplishes what I want but is this
the "best" way?

One case in which the   does not work very well is when the cell
text is a "hot link" (an href anchor tag); then the  's are
underlined and it doesn't look good.

Any thoughts?

Thanks

CSS is the way to go, for example:

td {padding-left:.5em}

This will affect all tds in the table. Put it in an external sheet
(recommended), or put it in the head in a style element.

HTH
 
P

Philip

Martin said:
In some cases, I want to space the data in a table cell over a little
bit (have some white space between the left cell border and the text).
But ONLY on the left side - not at the top and bottom. If I set the
"padding", it enlarges the entire cell - I don't want that.

<table>
<tr>
<td style="padding-left: 2em;">the quick brown fox etc.</td>
</tr>
</table>
 
M

Martin

In some cases, I want to space the data in a table cell over a little
bit (have some white space between the left cell border and the text).
But ONLY on the left side - not at the top and bottom. If I set the
"padding", it enlarges the entire cell - I don't want that.

I generally do this by inserting several "&nbsp;" before the cell text
when I generate the table. This accomplishes what I want but is this
the "best" way?

One case in which the &nbsp; does not work very well is when the cell
text is a "hot link" (an href anchor tag); then the &nbsp;'s are
underlined and it doesn't look good.

Any thoughts?

Thanks

Adrienne & Philip:

Thanks - got it working like I want it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top