Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set min-width in HTML table's <td>

My table has several columns.

Each column should have dynamic width that depends on the browser window size. On the other hand, each column must not be too tiny. So I tried to set min-width for those columns but it's not a valid property. Tried min-width for <td> as well but that too is an invalid property.

Is there any way to set min-width for col/td in HTML table?

like image 488
Thanhma San Avatar asked Aug 29 '13 06:08

Thanhma San


People also ask

How do I change td width in HTML?

To set the cell width and height, use the CSS style. The height and width attribute of the <td> cell isn't supported in HTML5. Use the CSS property width and height to set the width and height of the cell respectively.

How do I fix TD size in HTML?

By using CSS, the styling of HTML elements is easy to modify. To fix the width of td tag the nth-child CSS is used to set the property of specific columns(determined by the value of n) in each row of the table.

How do I auto adjust column width in HTML?

If the text is non wrapping text then you set the cell to width:1px and use white-space:nowrap. The text in that column will then determine the width of the cell. It's a technique commonly used for images and captions (without the white-space:nowrap) and allows text to wrap at the limits of an image automatically.


1 Answers

try this one:

<table style="border:1px solid"> <tr>     <td style="min-width:50px">one</td>     <td style="min-width:100px">two</td> </tr> </table>
like image 142
postgresnewbie Avatar answered Oct 14 '22 12:10

postgresnewbie