job
job

Reputation: 29

Make an image fill up the cell completely

I want a image to fill up the table cell completely. with css i've set the padding to zero but it does not help. Anybody has any thoughts on this?

Greetz Job

.HTML

<div id="vakjes">
<table id="tabel" border="1">
<tr>
    <td><img class="" src="images/jack.png"></td>
    <td><img class="" src="images/jack.png"></td>
</tr>
<tr>
    <td><img class="" src="images/jack.png"></td>
    <td><img class="" src="images/jack.png"></td>
   </tr>
</table>
</div>


CSS

table, tr, td {
 border: 1px solid #FF7300;
 padding: 0px;
 vertical-align: bottom;
}

#tabel {
 width: 345px;
 height: 345px;
}

Here is a screenshot of my table http://i62.tinypic.com/1584fnb.png

Upvotes: 0

Views: 3521

Answers (2)

Chong Yu
Chong Yu

Reputation: 470

Is it because you are setting the width and height of the table in CSS #tabel? Maybe the image is slightly smaller than the expected table size. Try it without the #tabel CSS.

Upvotes: 0

user3913686
user3913686

Reputation:

Try setting the height and width of your image:

here's a demo where i've set:

img{
    width:100%;
    height:100%
}

Alernatively, if you didn't want all images to be set, you could create it as:

.myStyle{
width:100%;
height:100%;
}

and then for your images add the class 'myStyle'.

Upvotes: 4

Related Questions