views:

52

answers:

3

I have an html table in which I am placing images side by side inside the td's. How can I get it so that there is no space at all between each image? By default all browsers seem to put in a small space despite 0 padding and margin on each table element. I am not specifying a width on the td's so by default it takes up the width of the image inside of it.

i.e:

<table>
  <tr>
    <td><img ... /></td> //no space between the td's
    <td><img ... /></td>
  </tr>
</table>
A: 

Take a look at cellpadding, border, and cellspacing attributes for the HTML table tag. If you are using XHTML or CSS, then check out the corresponding styles - border-collapse, padding, etc.

Jason McCreary
+2  A: 

Apply this css:

td, tr, img  { padding: 0px; margin: 0px; border: none; }
table { border-collapse: collapse; }

This resets all spaces to 0.

dark_charlie
+1  A: 

cellspacing and cellpadding should be 0 on the table.

<table cellspacing="0" cellpadding="0">
  <tr>
    <td><img></td> 
    <td><img></td>
  </tr>
</table>
Vinay B R