Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a td's width to 0

How can I set the width of an td to 0? I have a td without any content in it but it has always a width of 2px.

My first suspicion was the border-spacing property but setting it to 0 doesn't help neither.

    <table>
    <tr>
        <td></td>
        <td></td>
        <td></td>
    </tr>
</table>

See Sample

like image 898
juleee Avatar asked Jun 10 '13 13:06

juleee


2 Answers

Set tds padding to 0 adding padding: 0; to your td css rule.

like image 108
nstCactus Avatar answered Sep 28 '22 03:09

nstCactus


You'll need to remove the padding. ( td { padding: 0; })

Modern web browsers make it quite easy to track down questions like this. For example, using the Chrome Developer tools you can highlight the element and take a look at the Metrics tab and find out what is causing your width.

enter image description here

like image 28
Zeph Avatar answered Sep 28 '22 04:09

Zeph