Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make table column widths fixed?

I have a table with two columns, first column 65%, second 35%. It perfectly fits to 100% of screen, if first column has enough text in it to fill that 65%, but if it is empty (or small amount of text) - then first column shrinks and second expands.

How can I make first column ALWAYS 65% of screen, with or without text?

like image 747
Владимир Романов Avatar asked Sep 12 '26 04:09

Владимир Романов


1 Answers

Try this:

<table class="fixed_width">
    <col width="65%" />
    <col width="35%" />
    <tr>
        <td>your data</td>
        <td>your data</td>
    </tr>
</table>

And CSS:

table.fixed_width { table-layout:fixed; }
table.fixed_width td { overflow: hidden; }
like image 123
Kalpesh Patel Avatar answered Sep 13 '26 17:09

Kalpesh Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!