I've got a table like this:
<table border=1 style="width: 100%">
<tbody>
<tr>
<td>
squish this one
</td>
<td>
expand this one
</td>
</tr>
</tbody>
</table>
I'd like the left column to be as narrow as possible, and the right column to take up the rest of the screen. Is this possible?
Want to “fix a table row or column” in HTML? Only to find out that there are no direct ways in HTML? The possible ways to freeze or fix a row/column in HTML and CSS are: Limit the height of the table body and set it to auto overflow.
Use CSS to make your tables look better. If you add a background color on every other table row, you will get a nice zebra stripes effect. To style every other table row element, use the :nth-child (even) selector like this:
HTML tables can have different sizes for each column, row or the entire table. Use the style attribute with the width or height properties to specify the size of a table, row or column.
How to Create an HTML Table with a Fixed Left Column and Scrollable Body. It is possible to create a table, which has a fixed left column and a scrollable body. For that, you’ll need to use some CSS. You can use the position property set to “absolute” for the first column and specify its width. Then use the overflow-x property set to “scroll” ...
<table border=1 style="width: 100%">
<tbody>
<tr>
<td width="1">
squish this one
</td>
<td width="*">
expand this one
</td>
</tr>
</tbody>
</table>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With