Connecting Tech Pros Worldwide Forums | Help | Site Map

100% vertically expanding div

clain's Avatar
Member
 
Join Date: Feb 2007
Location: Chennai, INDIA
Posts: 68
#1: Dec 18 '08
Do you guys know how to make a div expand vertically 100%..

i do have a solution with Javascript.. but its not the right way. any CSS tricks will be helpful..

also many such tricks works in IE just like giving 100% height to body..etc..

i need a FF and IE compatible one..

any wild guess.

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,573
#2: Dec 18 '08

re: 100% vertically expanding div


Quote:

Originally Posted by clain View Post

also many such tricks works in IE just like giving 100% height to body..etc..

i need a FF and IE compatible one..

any wild guess.

No wild guesses. Just like you said, give the body and your div a height of 100%. Works every time.
clain's Avatar
Member
 
Join Date: Feb 2007
Location: Chennai, INDIA
Posts: 68
#3: Dec 18 '08

re: 100% vertically expanding div


no buddy that one did not work in Firefox...!!!! its OK with IE....
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#4: Dec 18 '08

re: 100% vertically expanding div


can you show what you have tried, like:

Expand|Select|Wrap|Line Numbers
  1. <div style="height:100%;border:solid;">some content</div>
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,573
#5: Dec 18 '08

re: 100% vertically expanding div


Yes because I question what your other markup is. I use Firefox exclusively and that particular snippet I use frequently. Testing in my Windows notebook shows it works in IE and FF.
clain's Avatar
Member
 
Join Date: Feb 2007
Location: Chennai, INDIA
Posts: 68
#6: Dec 18 '08

re: 100% vertically expanding div


Expand|Select|Wrap|Line Numbers
  1. <body style="height:100%;" >
  2. <center>
  3. <div class="bg">
  4.  
  5. some content
  6. </div>
  7. </center>
  8. </body>
  9.  
and here is the class bg

Expand|Select|Wrap|Line Numbers
  1. .bg
  2. {
  3. width:955px;
  4. background:url(../images/mainbg.gif) repeat-y; 
  5. height:100%;
  6. }
  7.  
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,573
#7: Dec 18 '08

re: 100% vertically expanding div


That should be working but I'm heading to the airport.
clain's Avatar
Member
 
Join Date: Feb 2007
Location: Chennai, INDIA
Posts: 68
#8: Dec 18 '08

re: 100% vertically expanding div


do i have something to do with airport dude? ha ha .... anyway.... i'm just wandering and pondering with the problem
Reply

Tags
div, div expansion verticaly, vertical expanding div