By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.

cellpadding definition in HTML/CSS ?

P: n/a
For a table cell I want to have a padding of 3 pixel between the cell border and the text inside.
How do I specify this attribute in a <TD> resp. css ?

Mark

Jul 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Mark Richards wrote:
For a table cell I want to have a padding of 3 pixel between the cell border and the text inside.
How do I specify this attribute in a <TD> resp. css ?


td{
padding:3px;
}

For cellspacing:
<http://annevankesteren.nl/test/examples/tweakers/post-855071.htm> (just
an example of course).

--
Anne van Kesteren
<http://www.annevankesteren.nl/>
Jul 20 '05 #2

P: n/a
Mark Richards wrote:
For a table cell I want to have a padding of 3 pixel between the cell
border and the text inside. How do I specify this attribute in a <TD>
resp. css ?


The usual way:

td {
padding: 3px;
}

--
Jim Dabell

Jul 20 '05 #3

P: n/a
Mark Richards wrote:
For a table cell I want to have a padding of 3 pixel between the cell
border and the text inside. How do I specify this attribute in a <TD>
resp. css ?


td { padding: 3px; }

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #4

P: n/a
MH
> For a table cell I want to have a padding of 3 pixel ....
How do I specify this attribute in a <TD>...


'cellpadding' is a table, not a cell attribute, so why not just start a new
1x1 table in the cell and set the padding to 3px;
<td>
<table cellpadding="3">
<tr><td>3px padded cell</td></tr>
</table>
</td>

------
MH
Jul 20 '05 #5

P: n/a
MH wrote:
'cellpadding' is a table, not a cell attribute, so why not just start a
new 1x1 table in the cell and set the padding to 3px;


(a) Becuase it uses an insane quantity of markup
(b) Becuase its a pain to manage
(c) Becuase it lies about the semantics of the data
(d) Becuase its much much easier with CSS.

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #6

P: n/a
On Sun, 4 Jan 2004, MH wrote:
why not just start a new 1x1 table in the cell and set the padding
to 3px;


Do you *really* need to ask? No wonder that web design is thought to
be a baroque and illogical black art that just sometimes happens to
produce the desired visual result, caring nothing for the underlying
mess.

Jul 20 '05 #7

P: n/a
On Sun, 04 Jan 2004 16:56:33 +0100, Mark Richards wrote:
For a table cell I want to have a padding of 3 pixel between the cell
border and the text inside. How do I specify this attribute in a <TD>
resp. css ?


td#humbug {
padding: 3px;
}

<td id="humbug">whatever</td>

--

..

Jul 20 '05 #8

P: n/a

"MH" <no****@nowhere.no> wrote in message
news:bt**********@news3.tilbu1.nb.home.nl...
For a table cell I want to have a padding of 3 pixel ....
How do I specify this attribute in a <TD>...
'cellpadding' is a table, not a cell attribute, so why not just

start a new 1x1 table in the cell and set the padding to 3px;
<td>
<table cellpadding="3">
<tr><td>3px padded cell</td></tr>
</table>
</td>


I'm assuming this would be OK if, within your tabular data, you
had a cell which itself was a set of table data. Otherwise it's
kind of a long way around when CSS works so much easier.
Jul 20 '05 #9

P: n/a
Mark Richards wrote:
For a table cell I want to have a padding of 3 pixel between the cell
border and the text inside. How do I specify this attribute in a <TD>
resp. css ?


td.somestyle { padding: 3px; }

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #10

P: n/a
MH
> .... Otherwise it's kind of a long way around when
CSS works so much easier.


I agree.
The OP asked how to do this using html or CSS, also in the group
news:comp.infosystems.www.authoring.html , there I gave him an answer for
the html part.

------
MH


Jul 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.