Skip to content Skip to sidebar Skip to footer

Forcing A Certain Width/height With Overflow In A

I have a with table-layout set to fixed, so that all explicit width/height definitions are respected no matter what. I'm trying to get a certain
to overflo

Solution 1:

It won't work because the <td> will always have the size of an image


You can use height and width attributes. If the image size is 400x300, typing <img src="..." height="100" width="100" /> will show 100x100 image

If you want to crop an image use

<style>#id{
background:url(...) no-repeat; /* you can use background-position css property here... */height:100px;
width:100px;
</style><divid="image"></div>

Solution 2:

Using table-layout: fixed, you can only guarantee the column widths, not heights. Also, the content of cells has no bearing on those widths. From w3schools:

The horizontal layout only depends on the table's width and the width of the columns, not the contents of the cells.

How much control do you need over the individual cells? Are you going for hidden overflow or one that can scroll? It's not clear from your question.

Post a Comment for "Forcing A Certain Width/height With Overflow In A

"