开发者

How do I divide the remaining horizontal space between two columns in an HTML table?

开发者 https://www.devze.com 2023-01-03 22:17 出处:网络
I have an html table with say 5 columns.Three of the c开发者_Go百科olumns I want to have a fixed width (for example, td width=30,50,30).How would I divide the remaining horizontal space between the tw

I have an html table with say 5 columns. Three of the c开发者_Go百科olumns 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.


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>


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%.

0

精彩评论

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