Forum Moderators: open
I have a table layout and I want to place images in the cells without the table changing its dimensions. If the image is bigger that the cell, the cell grows bigger.
Is there a way to stop this? Or do i have to make my images the correct size? Which would be hard because it is fluid and changes size.
Thanks for any info :)
One way is to set the background image of the table cells instead of using an img tag inside the cells and set the size of the cells in the usual way:
#cell1 {
width:100px;
height:150px;
background:url(img/cell1.jpg) 0 0 no-repeat;
}
#cell2 {
width:200px;
height:150px;
background:url(img/cell2.jpg) 0 0 no-repeat;
}
<table>
<tr>
<td id="cell1"> </td>
<td id="cell2"> </td>
</tr>
</table>
The background images, however, won't get printed by default on most browsers.