This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html two columns widths unequal no matter what

 
Nina Binde
Ranch Hand
Posts: 85
  • 0
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
  • 0
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is 472? px, em, hamburgers, etc. Give it units.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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...
 
Katrina Owen
Sheriff
Pie
Posts: 1367
18
  • 0
  • 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.
 
dragonfly
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TRY:
[ May 09, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic