How to do cellpadding in CSS?

They have: 5 posts

Joined: Feb 2002

I can't for the life of me figure out how to set the padding for a table using css. In html it is cellpadding="4" but padding:4px or padding:10% does nothing, how can I do this?

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

See if this works.

td {
padding-top: 4px;
padding-bottom: 4px;
padding-left: 4px;
padding-right: 4px;
}

I just found this tut also.
http://www.w3schools.com/css/css_examples.asp

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

I had put 4pt by mistake in my first reply to your post and forgot to add the ;

it should be 4px;
oh and it works too. Laughing out loud

They have: 5 posts

Joined: Feb 2002

I was doing padding on the table, not the td. I can only get this to work if it is for the html tag td. But working nevertheless. I did

td { padding: 4px }

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

try this

table {padding-left : 4px;}

Busy's picture

He has: 6,151 posts

Joined: May 2001

unless your site is a personal site I wouldnt get into cellpadding etc to much as its not very universal yet

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.