/    Sign up×
Community /Pin to ProfileBookmark

Middle Div height to 100%

Hello,
I am trying to create a page that would act like frames but in CSS.
I have a header, mainContent and a footer div.

I cant for the life of me set the height of the mainContent Div to 100% without the scrollbar growing larger than the page.
I know I could set the scrollbars to hidden but I need the height of the mainContent Div to be the exact difference between the header and footer because I will be using that elements offsetHeight in JavaScript.
Any ideas on how to create something like this without javascript ?

[code]
———————————————————-

|
| header

|
———————————————————-

|
| [B]HOW TO SET MIDDLE HEIGHT?[/B]
|
|
|
|
|
|
|
|———————————————————-
| footer
|———————————————————-
[/code]

I can do it through JavaScript like so…

[code=php]

var bottomPanel = getEl(‘bottomPanel’);
var headerPanel = getEl(‘headerPanel’);
var top = headerPanel.offsetHeight;
var bottom = bottomPanel.offsetHeight;
var middlePanel = getEl(‘middlePanel ‘);
middlePanel .style.height = getDocumentSize().height – top -bottom + “px”;

[/code]

but I am hoping there is a CSS way…

Drew

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@CentauriJun 10.2008 — Is this something like what you want to do ?
Copy linkTweet thisAlerts:
@cgishackauthorJun 10.2008 — It is close ... I would like the scroll bar to be in the middle div.

I wonder if I can make this one work.

Thanks for the link
Copy linkTweet thisAlerts:
@mshalabiJun 12.2008 — make the Middle div fixed height and {overflow:scroll}
×

Success!

Help @cgishack spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...