Forum Moderators: not2easy
<table>
<tr>
<td>
<img src="pic1" width="100" height="10">
<img src="pic2" width="200" height="10">
</td>
</tr>
</table>
Now I want to fix the width of the table to say 80px such that it only displays the left 80% of the pic1 image. I cannot make it by setting the table width as
<table width="80">
Is there any way to do it in CSS?
Thank you.
Instead, you may place the table within a "div" and give that the style markup (either inline, or by creating a class in your stylesheet).
Now there are a couple of drawbacks to this approach. It will set the width of the whole table to 80px. With padding included, the image will actually display less --though you can fix this by adjusting the width you assign. But if you give the table a border, none will appear on the right side.
An alternative is to place a div with these styles inside the cell, like this:
<table>
<tr>
<td><div style="width:80px;overflow:hidden;">
<img src="pic1" width="100" height="10">
<img src="pic2" width="200" height="10">
</div></td>
</tr>
</table>