Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6588157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:00:42+00:00 2026-05-25T17:00:42+00:00

How can I create a layout that has a fixed height div on the

  • 0

How can I create a layout that has a fixed height div on the top and below it a div that ALWAYS takes up the rest of the page’s height and width. So if the window is resized the height and width of the second div resizes accordingly.

An example of what I want to achieve is similar found on http://omegle.com/

So far I came up with this:

<html>
<head>
<body style="width:100%;height:100%;position:absolute;background:#EEE;margin:0 auto">
<div style="border-bottom:1px solid #000;height:50px;background:#900">1st div</div>
<div style="height:100%;width:100%;background:#090">2nd div</div>
</body>
</html>

This gives me the fixed div on top, and the resizable div on the bottom, however the second div does not take the fixed div’s height into account and so the div ends up being bigger in height than I want it to be. If I scale down the height % of div 2 to say 80%, it will then fit, however it does not stay constant when resizing the window due to the fixed height block above.

I am looking for a javascript free solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:00:43+00:00Added an answer on May 25, 2026 at 5:00 pm

    Why don’t you give the body the content background color?

    See demo fiddle.

    CSS:

    html,
    body {
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        background: #090;
    }
    #header {
        border-bottom: 1px solid #000;
        height: 50px;
        background: #900;
    }
    

    And when you need the content really to stretch to the window bottom, then place it absolutely, like in this fiddle:

    CSS:

    #content {
        position: absolute;
        top: 51px;
        bottom: 0;
        background: #090;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a layout that has small panels at the top and
I've mocked up a page using 960.gs that has has several elements fixed in
I get this error Can't create handler inside thread that has not called Looper.prepare()
I'm attempting to build an Android layout that has a fixed footer, with the
I am trying to create a sidebar in my layout that has the behavior
I can create a contact that is not mail enabled, but how do I
One can create an anonymous object that is initialized through constructor parameters, such as
I am trying to create a layout that will looking like: +---+--------+---+ | |
The developer documentation has seemed to have failed me here. I can create a
I'm trying to create an App that has a 2-tabbed activity, where tab1 has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.