Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make an HTML table column squish as tightly as possible? (Or, grow as much as possible?)

Tags:

html

css

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?

like image 778
mike Avatar asked Apr 03 '09 22:04

mike


People also ask

How to “fix a table row or column” in HTML?

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.

How to make your tables look better with CSS?

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:

How do I change the size of a HTML table?

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 a table with a fixed left column and scrollable?

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


1 Answers

<table border=1 style="width: 100%">
<tbody>
    <tr>
      <td width="1">
        squish this one
      </td>
      <td width="*">
        expand this one
      </td>
    </tr>
  </tbody>
</table>
like image 72
cobbal Avatar answered Nov 14 '22 23:11

cobbal