Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjusting table cell width

Let's take 4 table columns - ID, Text, Date, Action. In my case table have always constant width - in example 960px.

How can I create such table as :

*-*------------------------------------*----------*----*
|1| Some text...                       |May 2011  |Edit|
*-*------------------------------------*----------*----*
|2| Another text...                    |April 2011|Edit|
*-*------------------------------------*----------*----*

As we can see, ID, Date and Action adjust their width to content, Text is as long as possible....

Is that possible to do without setting specific width of columns ? When ID = 123 or Date = November 2011, columns should automatically be wider...

like image 930
Mr Sooul Avatar asked Sep 30 '11 16:09

Mr Sooul


People also ask

How do you fix a cell size in Word table?

To adjust table row and column size in Word: Click anywhere in the table. In "Table Tools" click the [Layout] tab > locate the "Cell Size" group and choose from of the following options: To fit the columns to the text (or page margins if cells are empty), click [AutoFit] > select "AutoFit Contents."

How do you adjust cell width and height?

Press E and the Height option opens. Enter your choices and press Enter. To change the column width, press Alt+O and then press C (for Column) and then W (for width). Type your values and press Enter.


1 Answers

Try this:

.id, .date, .action is the table cells (td).

CSS:

.id, .date, .action {
   width: 1em;
}

It worked for me.

The width:1em will not cut the text but force the width size to the minimum.

like image 104
robcaa Avatar answered Sep 20 '22 17:09

robcaa