Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There is always a little space under images inside a table

Tags:

css

I'll provide direct link for people who wants to see it live.

Just hover one of the table listing and you'll see there is always a small space under images. I've tried padding, margin, searched stackoverflow for it and used border spacing, border collapse etc. but nothing helped so far.

I would like your help. What's the problem and what am I missing?

like image 821
Lyver Kinkki Avatar asked Jan 31 '13 12:01

Lyver Kinkki


People also ask

How do I get rid of the gap under my image?

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.

How do you get rid of gaps in a table?

The space between the table cells is controlled by the CELLSPACING attribute in the TABLE tag. By setting CELLSPACING to zero, you can remove all the space between the cells of your table.

How do you space in a table?

The space between two rows in a table can be done using CSS border-spacing and border-collapse property. The border-spacing property is used to set the spaces between cells of a table and border-collapse property is used to specify whether the border of table is collapse or not.

Which element is used to leave the space around the image?

Padding is used to create space around an element's content, inside of any defined borders. This element has a padding of 70px.


3 Answers

Add display: block to img.

    .browseBuilds_piece img{
       display:block
     }
like image 122
Michal Avatar answered Oct 27 '22 00:10

Michal


Problem isn't the table actually, img tags are inline elements and have that bottom spacing by default (something with line-height I guess, don't really know why).

Solution: div.browseBuilds tr.browseBuilds_piece img { display: block; }

like image 45
Simon Avatar answered Oct 26 '22 22:10

Simon


See this similar question. Because img is an inline element, whitespaces in the HTML source code around the img tag matter and will be displayed. Either remove the whitespaces from the code

<td style="vertical-align: middle;"><img src="./themes/default/images/builds/eski.jpg"></td>

or display the img as a block element, as Michal has pointed out.

like image 31
Lumen Avatar answered Oct 27 '22 00:10

Lumen