Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust table column width to content size

Tags:

Form (with firebug highlight hover the td):

example

Label column CSS:

width: auto; padding: 0; margin: 0; 

The problem:

Why my left columns have that invisible "padding-right"? It's not possible to shrink columns to fit their content?

--EDIT--

The problem was the table itself. I defined table with "width: 100%". Removed that and the problem is gone.

like image 449
Rui Carneiro Avatar asked Mar 29 '10 10:03

Rui Carneiro


People also ask

How do you adjust column widths to fit content?

To change the width of columns to fit the contents, select the column or columns that you want to change, and then double-click the boundary to the right of a selected column heading. To change the width of all columns on the worksheet, click the Select All button, and then drag the boundary of any column heading.

How do you resize a table row or column to exact dimensions in Word?

On the Layout tab, you can specify the custom height and width. To resize specific rows or column, click on a cell and then adjust the row/column. To make multiple rows or columns the same size, select the columns or rows and click Distribute Rows or Distribute Columns.

How do you auto adjust table td width from the content?

remove all widths and add . content-loader table tr td { white-space: nowrap; } ? Since you have a fixed width for the container, you have too many fields inside of it to fit properly. If you had less it probably would have adjusted on its own.


1 Answers

The problem was the table width. I had used width: 100% for the table. The table columns are adjusted automatically after removing the width tag.

like image 62
Rui Carneiro Avatar answered Sep 18 '22 17:09

Rui Carneiro