css - Making an HTML table column as small as possible but no smaller -



css - Making an HTML table column as small as possible but no smaller -

i have column labels , corresponding text boxes, viz:

<table> <tr> <td>label:</td> <td><input type="text"></input></td> </tr> <tr> <td>longer label:</td> <td><input type="text"></input></td> etc...

i want ensure first column wide plenty allow text in 1 line, no wider necessary, allow maximum space input boxes (which set width 100%). don't want set specific percentage or explicit width, "as little possible no smaller."

is there way in raw html/css or have resort javascript?

(obviously if page narrow not achievable, i'm not worried narrow browsers.)

as long don't set width table,tr or td, td's text in 1 line. if space not plenty can utilize td {white-space:nowrap}. not allow text go sec line, show scrollbar.

demo: http://jsfiddle.net/rav4s/

html css table

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -