Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html images in table with no space

Tags:

html

css

image

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>
like image 597
bba Avatar asked Sep 29 '10 20:09

bba


People also ask

How do I put no space between images in HTML?

To remove the unwanted space between images or similar HTML elements do one of the following: Put all the elements on one line with no spaces between them. Put the closing bracket of the previous element immediately before the next element on the next line. Comment out the end of line marker (carriage return).

How do I remove blank spaces in a table in HTML?

HTML tables are comprised of rows and cells. In traditional HTML coding you remove the spacing within a cell by setting the “cellspacing” attribute to zero.

Can you put images in tables in HTML?

Note: A table cell can contain all sorts of HTML elements: text, images, lists, links, other tables, etc.

How can the gap under the image be removed in CSS?

Display Property: The most commonly used solution is used to change the display property of the <img> tag inside the <div> container from default 'inline' value to 'block' using display : block property.


1 Answers

One more thing that can avoid unwanted space between images:

<td style="line-height:0;">
like image 100
Francis Avatar answered Oct 23 '22 21:10

Francis