How to split the remaining horizontal space between two columns in an HTML table?

I have an html table with 5 columns. Three columns that I want to have a fixed width (e.g. td width = 30.50.30). How would I divide the remaining horizontal space between the two remaining columns? I thought I would do this by simply setting the width properties for each column to “50%,” but that doesn't seem to work.

+3
source share
2 answers

In my simple test, I didn’t have to set anything, and the default behavior was evenly broken. Of course, real content can push you, so you can help css and html.

<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>
+1
source

, , , 50%.

+2

Source: https://habr.com/ru/post/1750365/


All Articles