I have a table with fixed height, and inside I have a table cell with an icon image that needs to be constrained to the height of the table cell. However, no matter what I've tried, the image will either force the table to expand or just ignore the height: 100%
.
Here is the unmodified JSFiddle with the initial layout and styling.
Things I have tried based on other SO answers:
- Make sure all parents of
img
have 100% height (source): JSFiddle table-layout:fixed
,white-space: nowrap
, andoverflow: hidden
(source): JSFiddle- inner
position: absolute
div to exclude it from layout calculations (source): JSFiddle - inner
float: left
div to exclude it from layout calculations: JSFiddle
Update:
I'd rather not set the table cell height manually because in the actual layout, the table fits inside a top bar:
So all the heights inside the table should be dynamic