Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

html two columns widths unequal no matter what

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Bear Bibeault
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are saying that setting width="50%" has no effect?
 
Nina Binde
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you could post a complete example that demonstrates the issue?
 
Nina Binde
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

cos it is proprietary

Please use real words like "because", not "cos", when posting to the forums.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is 472? px, em, hamburgers, etc. Give it units.

Eric
 
Bear Bibeault
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought the width attribute was always in pixels? I always use CSS so I don't remember...
 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TRY:
[ May 09, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic