table cellpadding

He has: 688 posts

Joined: Feb 2001

Hi, all.

Not really a big problem, but I was wondering how to initiate "cellpadding" but only on a particular cell? I'm, looking for a "margin" effect in only one so that text and images don't butt up against the edges. I know I can nest another table inside that cell (with a cellpadding value other than zero), but I was just wanted to check if there was some other tag that I wasn't aware of that can do this.

Thanks.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

There's no way to do this in html so you'll have to use CSS. Just create a class for your padded cell (Ha!!!), define some padding for it in your stylesheet, and apply the class to the cells you want to be padded. ANother way would be to enclose your cell contents in a div that has the padding applied to it - that's what I tend to do but I'm not sure if there's an advantage one way or the other.

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Don't do it with nested tables, that'll be bad coding and you'll end up in the padded cell! Wink

Busy's picture

He has: 6,151 posts

Joined: May 2001

depending on how wide you want it you can also use

or   either side.

no matter how you do it, nested tables is about the only way you can get a similar result for all browsers (new and old) unless you make different style sheets per browser version and even then some ver5 and 6 have issues.

Just remember no one is going to be viewing your site with two different browsers at the same time so they wont know if it's slighty different Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.