d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help: Css - Div Vertical Extension
Add Reply New Topic New Poll
Member
Posts: 2,859
Joined: Apr 7 2010
Gold: 0.03
May 24 2012 09:40pm
Hey guys,

So I did a lot of reading and Googling, and it seems that getting a DIV to fill space vertically using CSS is not a simple task.
I saw various people suggest using bottom: 0; as a way, or even using JavaScript, etc.

However, after trying many of the different solutions, I could not seem to get it working. I'm stuck, and was wondering
if anyone could give me some insight.

The site I am working on right now can be found at: http://www.twff.ca/home.php

If you look at the content box with the white background, as well as the right panel, I want to be able to make those dynamically
fill the page depending on what content I have. Help would be much appreciated.

This post was edited by kumahoshi on May 24 2012 09:41pm
Member
Posts: 2,859
Joined: Apr 7 2010
Gold: 0.03
May 24 2012 11:28pm
Nvm, after much experimentation, I was able to get it working using display: tables.

Thanks anyways!
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
May 25 2012 12:53pm
Quote
Not Found

The requested URL /home.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


gg no re

e. Back when I first started my HTML classes, it took my about 5 seconds to figure out how to do this with some jQuery. You could do it with normal JavaScript, but it takes significantly more code (probably not as many lines, but more typing).

Assuming you have a two column layout, you grab the height of the longer div column, and just use the following code to make them the same heights.

Code
$('#divOne').height() = $('#divTwo').height();


This post was edited by BreakPoint on May 25 2012 12:58pm
Member
Posts: 57
Joined: May 23 2012
Gold: 0.00
Warn: 10%
May 27 2012 06:15am
body {
height:100%;}
column1{
height:100%;}


the columns must be in something that also has a height defined, in this case itll be ur body
Member
Posts: 2,859
Joined: Apr 7 2010
Gold: 0.03
Jun 6 2012 04:24pm
Quote (BreakPoint @ May 25 2012 11:53am)
gg no re

e. Back when I first started my HTML classes, it took my about 5 seconds to figure out how to do this with some jQuery. You could do it with normal JavaScript, but it takes significantly more code (probably not as many lines, but more typing).

Assuming you have a two column layout, you grab the height of the longer div column, and just use the following code to make them the same heights.

Code
$('#divOne').height() = $('#divTwo').height();


This wouldn't have worked since depending on the page, one column would've been taller than the other and vice versa. It wasn't the other one that was always taller.

As for the height 100% fix. I tried that as well, but it was giving me quite a lot of weird behaviour so I ditched that approach.
Member
Posts: 29,723
Joined: Jun 11 2007
Gold: 279.52
Jun 7 2012 02:35am
you cant set height with percentages
you have define it with a pixel or em number.

not exactly sure what your trying to do.
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Jun 7 2012 05:04pm
Quote (AkuuZ @ 7 Jun 2012 09:35)
you cant set height with percentages
you have define it with a pixel or em number.

not exactly sure what your trying to do.


Sure you can. http://jsfiddle.net/KSbxD/3/
The trick is to define 100% height to html before body.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll