Quantcast
Channel: Set cellpadding and cellspacing in CSS? - Stack Overflow
Browsing latest articles
Browse All 31 View Live

Answer by Rafiqul Islam for Set cellpadding and cellspacing in CSS?

You can easily set padding inside the table cells using the CSS padding property. It is a valid way to produce the same effect as the table's cellpadding attribute. table, th, td { border: 1px solid...

View Article



Answer by Alireza for Set cellpadding and cellspacing in CSS?

You can simply do something like this in your CSS, using border-spacing and padding: table { border-collapse: collapse; } td, th { padding: 1em; border: 1px solid blue; } <table> <tr>...

View Article

Answer by MD Ashik for Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: For cell-padding: Just call simple td/th cell padding. Example: /******Call-Padding**********/ table { border-collapse: collapse;...

View Article

Answer by user6781634 for Set cellpadding and cellspacing in CSS?

table { border-spacing: 4px; color: #000; background: #ccc; } td { padding-left: 4px; }

View Article

Answer by fuddin for Set cellpadding and cellspacing in CSS?

<table> <tr> <th>Col 1</th> <th>Col 2</th> <th>Col 3</th> </tr> <tr> <td>1</td> <td>2</td> <td>3</td>...

View Article


Answer by Pushp Singh for Set cellpadding and cellspacing in CSS?

For tables, cellspacing and cellpadding are obsolete in HTML 5. Now for cellspacing you have to use border-spacing. And for cellpadding you have to use border-collapse. And make sure you don't use this...

View Article

Answer by vapcguy for Set cellpadding and cellspacing in CSS?

How about adding the style directly to the table itself? This is instead of using table in your CSS, which is a BAD approach if you have multiple tables on your page: <table style="border-collapse:...

View Article

Answer by Majid Sadr for Set cellpadding and cellspacing in CSS?

td { padding: npx; /* For cellpadding */ margin: npx; /* For cellspacing */ border-collapse: collapse; /* For showing borders in a better shape. */ } If margin didn't work, try to set display of tr to...

View Article


Answer by Elad Shechter for Set cellpadding and cellspacing in CSS?

This style is for full reset for tables - cellpadding, cellspacing and borders. I had this style in my reset.css file: table{ border:0; /* Replace border */ border-spacing: 0px; /* Replace cellspacing...

View Article


Answer by suraj rawat for Set cellpadding and cellspacing in CSS?

Simply use CSS padding rules with table data: td { padding: 20px; } And for border spacing: table { border-spacing: 1px; border-collapse: collapse; } However, it can create problems in older version of...

View Article

Answer by suraj rawat for Set cellpadding and cellspacing in CSS?

CSS: selector{ padding:0 0 10px 0; // Top left bottom right }

View Article

Answer by Abhishek Singh for Set cellpadding and cellspacing in CSS?

table th,td { padding: 8px 2px; } table { border-collapse: separate; border-spacing: 2px; }

View Article

Answer by Dan for Set cellpadding and cellspacing in CSS?

Just use border-collapse: collapse for your table, and padding for th or td.

View Article


Answer by Falguni Panchal for Set cellpadding and cellspacing in CSS?

Try this: table { border-collapse: separate; border-spacing: 10px; } table td, table th { padding: 10px; } Or try this: table { border-collapse: collapse; } table td, table th { padding: 10px; }

View Article

Answer by Håkan Nilsson for Set cellpadding and cellspacing in CSS?

I used !important after the border-collapse like border-collapse: collapse !important; and it works for me in IE7. It seems to override the cellspacing attribute.

View Article


Answer by RolanDecoy for Set cellpadding and cellspacing in CSS?

From what I understand from the W3C classifications is that <table>s are meant for displaying data 'only'. Based on that I found it a lot easier to create a <div> with the backgrounds and...

View Article

Answer by Robert White for Set cellpadding and cellspacing in CSS?

Wrap the contents of the cell with a div and you can do anything you want, but you have to wrap every cell in a column to get a uniform effect. For example, to just get wider left & right margins:...

View Article


Image may be NSFW.
Clik here to view.

Answer by user669677 for Set cellpadding and cellspacing in CSS?

Default The default behavior of the browser is equivalent to: table {border-collapse: collapse;} td {padding: 0px;}           Cellpadding Sets the amount of space between the contents of the cell and...

View Article

Answer by George Filippakos for Set cellpadding and cellspacing in CSS?

The simple solution to this problem is: table { border: 1px solid #000000; border-collapse: collapse; border-spacing: 0px; } table td { padding: 8px 8px; }

View Article

Answer by Vitalii Fedorenko for Set cellpadding and cellspacing in CSS?

This hack works for Internet Explorer 6 and later, Google Chrome, Firefox, and Opera: table { border-collapse: separate; border-spacing: 10px; /* cellspacing */ *border-collapse: expression('separate',...

View Article

Answer by Malvineous for Set cellpadding and cellspacing in CSS?

For those who want a non-zero cellspacing value, the following CSS worked for me, but I'm only able to test it in Firefox. See the Quirksmode link posted elsewhere for compatibility details. It seems...

View Article


Answer by Eric Nguyen for Set cellpadding and cellspacing in CSS?

Basics 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...

View Article


Answer by corrector for Set cellpadding and cellspacing in CSS?

TBH. For all the fannying around with CSS you might as well just use cellpadding="0" cellspacing="0" since they are not deprecated... Anyone else suggesting margins on <td>'s obviously has not...

View Article

Answer by Pup for Set cellpadding and cellspacing in CSS?

table { border-collapse: collapse; /* 'cellspacing' equivalent */ } table td, table th { padding: 0; /* 'cellpadding' equivalent */ }

View Article

Answer by Will Prescott for Set cellpadding and cellspacing in CSS?

Setting margins on table cells doesn't really have any effect as far as I know. The true CSS equivalent for cellspacing is border-spacing - but it doesn't work in Internet Explorer. You can use...

View Article


Answer by mat for Set cellpadding and cellspacing in CSS?

Also, if you want cellspacing="0", don't forget to add border-collapse: collapse in your table's stylesheet.

View Article

Set cellpadding and cellspacing in CSS?

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?

View Article

Answer by Greggo for Set cellpadding and cellspacing in CSS?

I suggest this and all the cells for the particular table are effected. table.tbl_classname td, th { padding: 5px 5px 5px 4px ; }

View Article

Image may be NSFW.
Clik here to view.

Answer by Amaresh Tiwari for Set cellpadding and cellspacing in CSS?

You can check the below code just create a index.html and run it.<!DOCTYPE html> <html> <head> <style> table{ border-spacing:10px; } td{ padding:10px; } </style>...

View Article



Answer by MattAllegro for Set cellpadding and cellspacing in CSS?

Say that we want to assign a 10px "cellpadding" and a 15px "cellspacing" to our table, in a HTML5-compliant way. I will show here two methods giving really similar outputs.Two different sets of CSS...

View Article

Answer by Muhammad Tahseen ur Rehman for Set cellpadding and cellspacing in CSS?

This worked for me:table {border-collapse: collapse}table th, table td {padding: 0}

View Article
Browsing latest articles
Browse All 31 View Live


Latest Images