Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes Positioning the column in the table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Positioning the column in the table" Watch "Positioning the column in the table" New topic
Author

Positioning the column in the table

Ismael Upright
Ranch Hand

Joined: Feb 15, 2007
Posts: 166
Hello,

I have a table with 2 columns. I want:
- make the table to fill all possible width
- text in second column not to be wrapped
- second column to have the width equal to width of the longest text line inside this column

Everything without scripts and CSS, just plain old HTML

Is it possible to do?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

What have you tried? And why the rather odd "no CSS" directive?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ismael Upright
Ranch Hand

Joined: Feb 15, 2007
Posts: 166
Actually I know how to make a table with width to the screen size, the problem is how to make the second column to behave as I want.

I'll try to draw it:

Mr---------------------------------------------------------------------------------------Mrs-----
John Doe--------------------------------------------------------------------------------Jane Doe
Washington------------------------------------------------------------------------------Paris----
USA-------------------------------------------------------------------------------------UE------


Text in second column is to be aligned to the left (at least I tried...), but the column itself is supposed to be on the right side of the screen.
The width of the second column is to be equal to the widest text line contained in it (which is "Jane Doe").
The table is supposed to have the screen width.


Why "no CSS" well... long story short - it is supposed to be a HTML document builder, where you give the small pieces of document (like "John Doe personal data piece" and "Jane Doe personal data piece") and receive a complete document. One of the assumptions is "no CSS" directive
Ismael Upright
Ranch Hand

Joined: Feb 15, 2007
Posts: 166
Found the solution: <col width="0*">



 
jQuery in Action, 2nd edition
 
subject: Positioning the column in the table
 
Similar Threads
Same CSS rule for td width works for Firefox, but does not work for IE
selectOneRadio with nowrap
Tom
Table width calculation
JTable Troubles.