aspose file tools*
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 Java 8 in Action this week in the Java 8 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

Positioning the column in the table

Ismael Upright
Ranch Hand

Joined: Feb 15, 2007
Posts: 166

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

Joined: Jan 10, 2002
Posts: 60077

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:

John Doe--------------------------------------------------------------------------------Jane Doe

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*">

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
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
JTable Troubles.
Table width calculation