Vertically Expanding a DIV inside a Table TD

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2009
Posts: 12
Reputation: UzuNarU is an unknown quantity at this point 
Solved Threads: 0
UzuNarU's Avatar
UzuNarU UzuNarU is offline Offline
Newbie Poster

Vertically Expanding a DIV inside a Table TD

 
0
  #1
Nov 2nd, 2009
I looked around for a solution on the site but I couldn't find exactly what I was looking for so...

On my website I have a Table with 2 columns, each column has a DIV in it. How can I make it so that each of the DIVs take up the entire space in the Table TD? I can post an example or link to the site itself...if thats allowed.
~UzuNarU~ - Endless Possibilities
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 14
Reputation: soldierflup is an unknown quantity at this point 
Solved Threads: 0
soldierflup's Avatar
soldierflup soldierflup is offline Offline
Newbie Poster
 
0
  #2
Nov 4th, 2009
Why using DIV's in a table ?

You can get the same result by floating the two divs with CSS.

html :

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <style>
  4. #divone {
  5. width: 50%;
  6. float: left;
  7. }
  8. #divtwo {
  9. width: 50%;
  10. float: left;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <div id='divone'>bla bla bla</div>
  16. <div id='divtwo'>bla bla bla</div>
  17. </body>
  18. </div>

If you persist in keeping the divs in a table column I don't see the problem because the row of the table will automatically expand to the content of the largest div.

An example of your code would the interesting to see what you want to achieve.
Last edited by soldierflup; Nov 4th, 2009 at 6:02 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 12
Reputation: UzuNarU is an unknown quantity at this point 
Solved Threads: 0
UzuNarU's Avatar
UzuNarU UzuNarU is offline Offline
Newbie Poster
 
0
  #3
Nov 4th, 2009
Umm, you can take a look at the site: http://www.uzunaru.com

If I float the DIVs does that mean they will appear side by side? Sorry, I'm not really very good at doing more fancy web templates/layouts. Usually I just do plain sites but wanted to try something different.
~UzuNarU~ - Endless Possibilities
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 14
Reputation: soldierflup is an unknown quantity at this point 
Solved Threads: 0
soldierflup's Avatar
soldierflup soldierflup is offline Offline
Newbie Poster
 
0
  #4
Nov 4th, 2009
If you float the divs the will appear side by side. I've been looking at your code and I suppose you want to make appear the right div at the top of the column in your table. Change your code from the right column of your table to :

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <td width="251px" valign="top">

This will put the div inside your column at the top of the column.
Last edited by soldierflup; Nov 4th, 2009 at 9:36 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 12
Reputation: UzuNarU is an unknown quantity at this point 
Solved Threads: 0
UzuNarU's Avatar
UzuNarU UzuNarU is offline Offline
Newbie Poster
 
0
  #5
Nov 4th, 2009
Originally Posted by soldierflup View Post
If you float the divs the will appear side by side. I've been looking at your code and I suppose you want to make appear the right div at the top of the column in your table. Change your code from the right column of your table to :

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <td width="251px" valign="top">

This will put the div inside your column at the top of the column.

Hmm ok, that solves one problem. Now the problem of the Nav column not expanding to the whole available area in the right column is the second. If I have to I will check out this "float". Quick Q~ about floating DIVs do that need a containing DIV?
~UzuNarU~ - Endless Possibilities
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 14
Reputation: soldierflup is an unknown quantity at this point 
Solved Threads: 0
soldierflup's Avatar
soldierflup soldierflup is offline Offline
Newbie Poster
 
0
  #6
Nov 4th, 2009
The div's don't need a containing div because they are already in a containing div (container).
To make sure that the next div (footer) will appear correctly is adding the next statement under the second floated div : <br style="clear: both;" />

If you want to, I'll send you a redesigned example of your page.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 12
Reputation: UzuNarU is an unknown quantity at this point 
Solved Threads: 0
UzuNarU's Avatar
UzuNarU UzuNarU is offline Offline
Newbie Poster
 
0
  #7
Nov 4th, 2009
Originally Posted by soldierflup View Post
The div's don't need a containing div because they are already in a containing div (container).
To make sure that the next div (footer) will appear correctly is adding the next statement under the second floated div : <br style="clear: both;" />

If you want to, I'll send you a redesigned example of your page.
Sure you can do that if you want to. It would greatly help me.

Also my footer is outside my container because for some reason it was getting blended into the News/Navigation DIVs.
~UzuNarU~ - Endless Possibilities
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 480 | Replies: 6
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC