File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes html two columns widths unequal no matter what Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "html two columns widths unequal no matter what" Watch "html two columns widths unequal no matter what" New topic
Author

html two columns widths unequal no matter what

Nina Binde
Ranch Hand

Joined: Sep 24, 2004
Posts: 85
Please take a look at this html code. I want to have two columns of equal width. For some strange reason, if there is no content between the td tags, then the two column widths is equal. Once I have content between the td tags, thats when one of the columns width is always more than the other. I mean the content is different in both the columns. Lets just say, one of the them has the content and the other does not. The one which has the content is invariably larger than the other. How can I make the two columns equal irrespective of the content? I have tried setting the width="" on both the td tags, but it doesn't seem to make any difference. I am banging my head against the wall as to why I am not able to get the same width columns. Anybody has any ideas? Thank you guys!


[ April 29, 2008: Message edited by: Nina Binde ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

So you are saying that setting width="50%" has no effect?
Nina Binde
Ranch Hand

Joined: Sep 24, 2004
Posts: 85
Thank you Bear. I did fix the code to be UBB code specific.
Yes, the size of 50% or 236 in the td tag does not matter if there is content between the tags. It looks like it is dependent on the content since if I leave both the columns blank, the size is the same. If there is content which is remarkably different in the two columns, then the size of the columns also is different for some reason.
How do I fix that? Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Perhaps you could post a complete example that demonstrates the issue?
Nina Binde
Ranch Hand

Joined: Sep 24, 2004
Posts: 85
Unfortunately, I will not be able to post the entire code because it is proprietary and it is huge. I noticed it depends on the length of the text I type. The longer the length, the wider the column. For instance,



In the above code, the second column is invariably larger than the first one.
Is there someways I can eliminate that dependency and have two columns of equal width irrespective of the text I have between them? Thanks.

[ April 30, 2008: Message edited by: Nina Binde ]
[ April 30, 2008: Message edited by: Nina Binde ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

You can't specify a width for all the td's. You must leave one unspecified. Try specifying the width only for the first td.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

cos it is proprietary
Please use real words like "because", not "cos", when posting to the forums.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
What is 472? px, em, hamburgers, etc. Give it units.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

I thought the width attribute was always in pixels? I always use CSS so I don't remember...
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1364
    
  17
I'm not so sure how to do it in the HTML code, but if you can use a bit of CSS to control it, you should be able to specify



Tables can be shrinkwrapped, stretched, sized, or fixed. If they are fixed, they ignore the width of the content when laying out the columns.
dragonfly
Greenhorn

Joined: May 09, 2008
Posts: 1
TRY:
[ May 09, 2008: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

"z zz",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html two columns widths unequal no matter what