/    Sign up×
Bounties /Pin to ProfileBookmark

How can cellpadding and cellspacing be set using CSS?

+ 1,000
Copy linkTweet thisAlerts:
Jul 05.2022
to post a answer
CSS

1 Replies

Copy linkTweet thisAlerts:
@JaySODec 05.2022 — To set the cellpadding and cellspacing of a table using CSS, you can use the padding and border-spacing properties, respectively. These properties should be applied to the td and th elements within the table.

Here is an example:

table {
border-collapse: separate;
}

td, th {
padding: 10px;
border-spacing: 10px;
}


In this example, cellpadding is set to 10px and cellspacing is set to 10px. These values can be adjusted as needed to achieve the desired effect.

Note: In order for the border-spacing property to take effect, the border-collapse property must be set to separate for the table. This ensures that each cell has its own distinct border, which can be spaced using the border-spacing property.
×

Success!

Help @hq 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 4.26,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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