views:

106

answers:

3

I set the width using:

style="width: 200px"

When the browser window is narrow, the td is the correct width. When I make the window wide, the td expands wider than what I set it to. Any ideas?

A: 

My guess would be that you have specified a width on the actual table and the cells within your table aren't equal to the width of the table. Thus internet explorer, and I would suspect most other browsers, have to compensate and widen all the cells, including your fixed width one.

Either remove the width specification from your table or change one of the cells in your table to something more flexible like a width="10%".

However, I this is not likely to be a good approach, though it might get you on the right track. @Darko Z is right, we need some more code.

David McEwing
Thanks David, enough to jostle my brain a bit and maybe help me find a different angle of attack.
morgancodes
A: 

Try using colgroups.

Also, you can try playing with other style attributes like dysplay, etc. I believe if you give a fixed width to each column, you have to set a fixed width to the table element.

Matias
Unfortunately, it's not my code, it's a header that's included in a script tag and rendered with document.write, so I can't change the structure very easily.
morgancodes
A: 

Almost for sure, you are out of luck here.

Browser treats bunch of nested autofit tables as one big complex thing. It tries to find optimal layout taking into account cell contents (minimum and maximum) width and various settings, like the one you have. None of the settings is considered set in stone.

So, if you have simple and non-contradictory requirements, they will be honored. Otherwise, all bets are off.

buti-oxa
Thanks, buti-oxa. That will help me feel better about myself when I give up :) Fortunately the bug this is causing is a fairly minor cosmetic one.
morgancodes