NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page XHTML Question: Best way to make div height 100%?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-26-2008, 09:27 PM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Mar 2005
Location: Singapore
Posts: 1,836
1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of
 



Animal Cruelty

Question XHTML Question: Best way to make div height 100%?


Let say, I have this example.

Code:
<div id="container">

<div class="contentA left">Lorem lipsum</div>
<div class="contentB right">Lorem lipsum</div>

</div>
.. where left and right is float left and right respectively.
????: NamePros.com http://www.namepros.com/programming/507968-xhtml-question-best-way-make-div.html

What is the best method (must be validated) to make the container's height 100% or fluid without declaring a fixed height value?

I seems to have some problem with this whenever there is floats inside the div.

Before, I used to use this:

Code:
#container {
overflow: auto;
height: 100%;
min-height: 100%;
}
But sometimes, the horizontal and vertical scrollbars will appear inside the div, especially in IE7.
1901gt is offline  
Old 08-26-2008, 09:31 PM   #2 (permalink)
Senior Member
 
Epic's Avatar
Join Date: Sep 2005
Posts: 3,779
Epic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond reputeEpic has a reputation beyond repute
 



Clear the floats. This isn't necessarily the best way to do it, but it works.

Code:
<div id="container">

<div class="contentA left">Lorem lipsum</div>
<div class="contentB right">Lorem lipsum</div>

<div style="clear: both;"> </div>
</div>
Epic is offline  
Old 08-26-2008, 10:52 PM THREAD STARTER               #3 (permalink)
Senior Member
Join Date: Mar 2005
Location: Singapore
Posts: 1,836
1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of
 



Animal Cruelty
Ok great! Works well for me.
1901gt is offline  
Old 09-10-2008, 01:24 AM THREAD STARTER               #4 (permalink)
Senior Member
Join Date: Mar 2005
Location: Singapore
Posts: 1,836
1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of1901gt has much to be proud of
 



Animal Cruelty
I think I've found a better way. Silly me.
Just insert the following inside the div and it will auto expand.

Code:
#container {
overflow: hidden;
}
1901gt is offline  
Old 09-11-2008, 04:17 PM   #5 (permalink)
Carpe Diem
 
Nathan's Avatar
Join Date: Apr 2007
Location: Brisbane
Posts: 908
Nathan is a splendid one to beholdNathan is a splendid one to beholdNathan is a splendid one to beholdNathan is a splendid one to beholdNathan is a splendid one to beholdNathan is a splendid one to beholdNathan is a splendid one to beholdNathan is a splendid one to behold
 



Special Olympics Cystic Fibrosis Save a Life
That should work, but if I remember correctly that could cause some of the content in the container to get cut off.
__________________
Nathan is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 07:05 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger