/    Sign up×
Community /Pin to ProfileBookmark

cellpadding + cellspacing

how do i set cellpadding+cellspacing in css?

…once i know the right css thing to set for it…if i put it in the body thing (like body {color: #123456}) will it change [B]all[/B] the tables’ cellpaddings and cellspacings?

thanx,
john

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisApr 14.2003 — Table cellpadding and cellspacing are not CSS attributes, they are HTML attributes.

If you set "padding" in the BODY, a table will not inherit that style, anyway. You can set "padding" on the TD or the TH.

I'm not sure of the relationship of cellspacing and border-width + margin + padding, but I'm sure you could get it to look like you want it to look by playing with those style variables.
Copy linkTweet thisAlerts:
@SearedIceauthorApr 14.2003 — thanx...i wasn't sure if it existed (i've never seen it)

i just thought it would help tidy up my code...i could get rid of all those long "cellpadding=0 cellspacing=0" attributes in the 3 tables i have

thanx again,

john
Copy linkTweet thisAlerts:
@jeffmottApr 14.2003 — [size=2]<style type="text/css">
table
{
border-collapse: collapse;
}
td, th
{
margin: 0;
padding: 0;
}
</style>[/size]
Copy linkTweet thisAlerts:
@SearedIceauthorApr 14.2003 — Thanx!

...i didn't know you could change multiple tag's css by using the comma *takes a note*

what's that collapse mumbo jumbo?

p.s. what's your signature supposed to mean?
Copy linkTweet thisAlerts:
@sscarfoMay 13.2006 — Id been looking for the solution posted by jeffmott for a while, it looks like the border-collapse function makes all the difference... just like the manual says ?

from www.w3.org/
The various border properties apply to columns only if 'border-collapse' is set to 'collapse' on the table element. In that case, borders set on columns and column groups are input to the conflict resolution algorithm that selects the border styles at every cell edge.[/QUOTE]

This css made it for me (set cellpadding and cellspacing to 0 on all tables), whats the difference?

table {

border-collapse: collapse;

margin: 0;

}
×

Success!

Help @SearedIce spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...