开发者

Having problems with HTML table height in IE how to set max height?

This I can't figure out despite my best effort. I got a table that has 4 cells; the the first cell is longest, has a fixed width and a 2 row span. The 2nd cell is supposed to have a fixed height. The contents of the 3rd cell are going to change often so I have no idea what the height is going to be, and the 4th cell has a col span of two.

It looks perfect in Firefox as it seems to let me set the cell height, but it looks poor in IE as it's completely ignoring it and for some reason, instead of making cel开发者_运维问答l 2 the fixed height or even the height of the content, it uses all the space the 3rd cell isn't using which makes the header look way bigger than it should when the content in the 3rd cell isn't big enough. This only seems to happen in IE; I tested both Chrome and FireFox and they both do it like I want. I'm using IE 9 the rest of the page works too; just this one annoying format issue. My site: http://gallery.pawworks.net. I'm trying to make a template for the rest of the site pages and the page content goes in the 3rd cell so thus why the template will not know the size.

As for what I tried in the cell that should have the fixed height:

  <td height="60" style="height:60px;max-height:60px;">

Edit: putting the Doctype tag in didn't help. what I've ended up doing is added a div tag to the cell that is the height I want and another to the cell that should be but isn't.

Used JavaScript to get the height of the one that is sized correctly, and the height of the other. If the height of the other is larger than the height of the first do nothing otherwise set the height of the second to match the first. That way if the content cell gets bigger than the nav cell it can expand, but if not it'll pad the extra space out so that IE keeps the cell at the correct min size which prevents the header cell from exceeding the max size which is what I was after (and can just outright set in every other browser I've tried).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜