|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CSS to control CELLSPACING in tables
I'm wondering if there is any CSS element that can control the cellspacing attribute of a table. I'm making a PHP script that will output tables to show some information, and the output will be put into a template. Inorder to allow people to control the looks of what my script makes, i've been giving everything an ID. The only thing so that that I havn't been able to do, is set the table's cellspacing attribute to 0 so that there is no space between the borders.
Here is a sample page of that it will currently do as apposed to what I want it to do. http://kicken.mine.nu:8008/extras/spacing.html In the second table, I set the cellspacing to 0 so you can see, but I want to be able to use CSS to do that. Anyone know of any property(margin: and padding: don't work, tried both) that I may be looking for? |
|
#2
|
|||
|
|||
|
Bottom line: I don't think it's possible.
I wanted to set cellspacing using CSS a while back, after some extensive testing and trawling through the CSS2 specification a few times I came up with nothing. In the end I had to manipulate the table's cellSpacing property via JavaScript. I can't help but feel that I missed something though, why on Earth it wouldn't be available is beyond me... |
|
#3
|
|||
|
|||
|
http://www.w3schools.com/css/pr_tab_border-collapse.asp
Code:
<table width="100" border="1" style="border-collapse: collapse">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
|
|
#4
|
||||
|
||||
|
Ahh, so that's what that does. Changes the color a bit but that's no big deal. Thanks degsy
|
|
#5
|
|||
|
|||
|
border-collapse is crucial here - but cellspacing is done to individual tds using margin, and cellpadding uses, hem, padding, also applied to the cell. If you apply them to the table element, the entire table gets spaced/padded (as a block).
|
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS to control CELLSPACING in tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|