Reputation:
I am displaying an image inside TD using:
But image seems to be taking larger width than the width defined for the TD.
Please provide me some solution.
Upvotes: 6
Views: 21868
Reputation: 1043
You could try this:
If you want ALL <td>
's to have images:
HTML:
<table class="imagetable">
<tr>
<td>Hey wat up</td>
</tr>
</table>
CSS:
.tableimage td {
background-image:url('http://example.com/image.jpg');
background-size: 100% 100%;
}
If you just want ONE <td>
to have an image
HTML:
<td class="image">Hey wat up</td>
CSS:
.image {
background-image:url('http://example.com/image.jpg');
background-size: 100% 100%;
}
Hope this helps :)
Upvotes: 1