tags:

views:

47

answers:

2

I have an html table with say 5 columns. Three of the columns I want to have a fixed width (for example, td width=30,50,30). How would I divide the remaining horizontal space between the two remaining columns? I thought I would do it by just setting each of the "width" properties for those columns to "50%", but that didn't seem to work.

+2  A: 

Instead of having two columns with the space split, have one column, nest another table inside of it, and put two columns on the nested table each with a width of 50%.

Eric Petroelje
+1 nested tables, sweet.
Byron Whitlock
@Byron - oh yeah, gotta love tables :)
Eric Petroelje
That only works for neighbouring columns.
buti-oxa
+1, Never would have thought of that.
zildjohn01
Isn't there a more straight forward way to do it using the "WIDTH" property? This must be a pretty common thing to have to do.
GregH
+1  A: 

In my simple test, I didn't have to put anything and the default behavior was to split evenly. Of course, real content may push things around, so seeing your css and html would help.

<html>
    <head>
            <style type="text/css">
                    td{border:1px solid #000; padding:1px;}
            </style>
    </head>
<body>

        <table width="300px">
        <tr><td width="50px"></td><td width="30px"></td><td width="50px"></td><td></td><td></td></tr>
    </table>
</body>
</html>
BioBuckyBall
Doing what I thought would not work does actually work. It was not working because I was overriding the default behavior elsewhere in my page through CSS. Once I fixed that, it did work by setting the remaining columns each to 50%
GregH
There you go, glad you got it fixed up :)
BioBuckyBall