Set cellpadding and cellspacing in CSS

0 votes
In an HTML table, the cellpadding and cellspacing can be set like this:

<table cellspacing="1" cellpadding="1">
How can the same be accomplished using CSS?
May 31 in CSS by Edureka
• 7,940 points
9 views

1 answer to this question.

0 votes

For controlling "cellpadding" in CSS, you can simply use padding on table cells. E.g. for 10px of "cellpadding":

td { 
    padding: 10px;
}

For "cellspacing", you can apply the border-spacing CSS property to your table. E.g. for 10px of "cellspacing":

table { 
    border-spacing: 10px;
    border-collapse: separate;
}

This property will even allow separate horizontal and vertical spacing, something you couldn't do with old-school "cellspacing".

answered Jun 10 by Edureka
• 8,820 points

Related Questions In CSS

0 votes
0 answers
0 votes
1 answer

small-caps font in css handles numbers as capital letters

Because numbers are not letters, they do ...READ MORE

answered May 28 in CSS by Edureka
• 8,820 points
19 views
0 votes
1 answer

nbsp not working in CSS content tag

May be this could be the solution ...READ MORE

answered May 28 in CSS by Edureka
• 8,820 points
21 views
0 votes
1 answer

What does !important mean in CSS?

The CSS! important rule is used to ...READ MORE

answered Jun 1 in CSS by Edureka
• 8,820 points
12 views
0 votes
0 answers

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and ...READ MORE

Jun 8 in HTML by Ashwini
• 200 points
11 views
0 votes
0 answers

How can I vertically center a div element for all browsers using CSS?

I want to center a div vertically with CSS. ...READ MORE

Jun 22 in CSS by Edureka
• 7,940 points
11 views
0 votes
0 answers

Best way to center a <div> on a page vertically and horizontally?

What is the best approach to vertically ...READ MORE

6 days ago in CSS by Edureka
• 7,940 points
6 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
4,476 views
0 votes
1 answer

How to set Bullet colors in UL/LI html lists via CSS without using any images or span tags

I use jQuery for this: jQuery('li').wrapInner('<span class="li_content" />'); & ...READ MORE

answered May 27 in CSS by Edureka
• 8,820 points
29 views
0 votes
1 answer

when declaring css styles, what is the meaning of .classA.classB (two class names with a dot in the middle and no space)

The first example (space-separated classes) is a ...READ MORE

answered 1 day ago in CSS by Edureka
• 8,820 points
9 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP