HighDots Forums  

Re: Stacking DIV's and using height: 100%?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: Stacking DIV's and using height: 100%? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ben C
 
Posts: n/a

Default Re: Stacking DIV's and using height: 100%? - 02-13-2008 , 02:32 AM






On 2008-02-12, Lypheus <lypheus (AT) gmail (DOT) com> wrote:
Quote:
I'd like to find a way to stack two divs vertically, where the top div
is a fixed height and the bottom dynamic in order to fill the
remaining page height. I know this can be done by using
position:absolute and using hidden divs to pad things out, but there
must be a cleaner approach to this problem out there.
You do need position: absolute (unless you use a table), but you don't
need hidden divs or z-index.

html, body
{
height: 100%;
margin: 0;
padding: 0;
}
body { position: relative }
#header { height: 96px; background-color: pink }
#content
{
background-color: palegreen;
position: absolute;
top: 96px;
bottom: 0;
left: 0;
right: 0;
}

...

<body>
<div id="header">Header</div>
<div id="content">Content</div>
</body>


Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: Stacking DIV's and using height: 100%? - 02-13-2008 , 06:00 PM






In article <slrnfr5apt.c0i.spamspam (AT) bowser (DOT) marioworld>,
Ben C <spamspam (AT) spam (DOT) eggs> wrote:

Quote:
On 2008-02-12, Lypheus <lypheus (AT) gmail (DOT) com> wrote:
I'd like to find a way to stack two divs vertically, where the top div
is a fixed height and the bottom dynamic in order to fill the
remaining page height. I know this can be done by using
position:absolute and using hidden divs to pad things out, but there
must be a cleaner approach to this problem out there.

You do need position: absolute (unless you use a table), but you don't
need hidden divs or z-index.

html, body
{
height: 100%;
margin: 0;
padding: 0;
}
body { position: relative }
#header { height: 96px; background-color: pink }
#content
{
background-color: palegreen;
position: absolute;
top: 96px;
bottom: 0;
left: 0;
right: 0;
}

...

body
div id="header">Header</div
div id="content">Content</div
/body
Indeed. This looks good. Am glad you posted this too (I have a
folder for odd bits and pieces on absolute position, which I need
every now and then).

I could not understand what OP meant by using the content area to
drag clippings to. I was thinking appearances were everything!

When he said,

"Looking for something very specific to start here, just have
96px tall header div and then being able to add a div below to
expand and fill the remaining height of the page (or containing
div), resizing as needed to fill out the page as it is resized."

I thought, why? Make it *look* as if it is...

--
dorayme


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.