What is Cellpadding & Cellspacing for table in html equivalent in CSS? I don't want to specify this all the time for my tables and just want to set it in CSS but couldn't find an element that does this, so please help identify. Thanks.
For cellpadding, simply use padding. For cellspacing, the css is border-spacing, but IE doesn't support that property. cheers, gary
Also, the last I checked, cellpadding and cellspacing were NOT depreciated attributes (even in Strict DOCTYPES) and are perfectly acceptable in your (X)HTML markup. Just let the HTML markup define the default presentation of the tabular data (in case the stylesheet doesn't get parsed by the user agent), and then use CSS to change its appearance to suit the presentation that your stylesheet has defined for your particular site's needs .
Based on my experiments, it looks to me that cellpadding and cellspacing for table is not replacable by padding & margin in CSS.
Dan: Ah, so you can actually set the border-spacing in CSS to over-ride the cellspacing attribute in the HTML?
Only if you use Microsoft's box model. Think of that Christmas present you got this year. You had the container (box) that held whatever it is you got this year (the content). Inside that container you probably had some bubble wrap protecting your present (padding). On the outside, you had the wrapping paper (border). Now let's say you had another present, one that was 2 inches away from the other. That space between them would be the margin. That's how the W3C box model works. So to answer your question (admittedly with another question), why would you want to use border-spacing when you could just apply a margin to your TD elements?
Quite simply, I currently wouldn't. But if I can gain some amount of knowledge to help me keep my options open... well, so much the better. Currently, instead of using cellspacing = "0" to fix the default cell spacing problem in IE, I've been using the css table attribute of border-collapse: collapse; so that I don't have to add that cellspacing="0" attribute to any of my pages.
You know, I opened a thread about the same/similar question back then; see: Table tag's CSS attributes that IE don't understand if you are interested ... /EDIT: Uhhh sorry, I wanted to post a link to this thread: Table element's CSS properties that IE doesn't understand ?? here on DP forums, not to the one above at Ars Technica forum. tayiper
tayiper: Thanks for the link! I'll have to take a look as soon as I finish up the tutorial I'm working on.
Duh, and sorry folks once again; that link above should poin to this thread: Table element's CSS properties that IE doesn't understand ?? instead .... tayiper