开发者

html table, variable width columns plus a floating width column

开发者 https://www.devze.com 2023-01-28 00:30 出处:网络
I have a table with 4 columns. The first 3 columns should only take up the space they need to display the data / ui control that is placed in them, whereas the fourth column should take up the remaini

I have a table with 4 columns. The first 3 columns should only take up the space they need to display the data / ui control that is placed in them, whereas the fourth column should take up the remaining space. I don't know while creating the table what widths the first three columns should be, so I can't put a "width" value in there.

If I set the fourth column to 100% width, then it squishes the first three columns too much; if there is a drop down list ("select" in html terms) in one of those columns, the last column would then force it to become somewhere around 20 pixels wide, whereas it should be as wide as the option element which has the longest text in that menu.

Other rows in the table will cells that span multiple columns, so I think I'm stuck using开发者_如何转开发 the table element (as opposed to divs etc)

Any ideas? IE6 is not supported by the site so whatever works in Firefox / Chrome should be good.


Try putting width:1%; white-space:nowrap; in the first three columns and leave the fourth without width

0

精彩评论

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