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 6331063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:59:12+00:00 2026-05-24T17:59:12+00:00

______________________ | Header | |______________________| | | | | | Content | | |

  • 0
 ______________________
|        Header        |
|______________________|
|                      |
|                      |
|        Content       |
|                      |
|                      |
|______________________|
|        Footer        |
|______________________|

I would like to make this UI, and each is a div. The header height is 30px. And the footer is 30px. But I don’t know the content height. I need to use the user frame to calculate.

The total height should be 100%.

Can I do it in pure CSS?

  • 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-24T17:59:13+00:00Added an answer on May 24, 2026 at 5:59 pm

    Using flexbox, this is easy to achieve.

    Set the wrapper containing your 3 compartments to display: flex; and give it a height of 100% or 100vh. The height of the wrapper will fill the entire height, and the display: flex; will cause all children of this wrapper which has the appropriate flex-properties (for example flex:1;) to be controlled with the flexbox-magic.

    Example markup:

    <div class="wrapper">
        <header>I'm a 30px tall header</header>
        <main>I'm the main-content filling the void!</main>
        <footer>I'm a 30px tall footer</footer>
    </div>
    

    And CSS to accompany it:

    .wrapper {
        height: 100vh;
        display: flex;
    
        /* Direction of the items, can be row or column */
        flex-direction: column;
    }
    
    header,
    footer {
        height: 30px;
    }
    
    main {
        flex: 1;
    }
    

    Here’s that code live on Codepen: http://codepen.io/enjikaka/pen/zxdYjX/left

    You can see more flexbox-magic here: http://philipwalton.github.io/solved-by-flexbox/

    Or find a well made documentation here: http://css-tricks.com/snippets/css/a-guide-to-flexbox/

    –[Old answer below]–

    Here you go: http://jsfiddle.net/pKvxN/

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=utf-8 />
    <title>Layout</title>
    <!--[if IE]>
      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <style>
      header {
        height: 30px;
        background: green;
      }
      footer {
        height: 30px;
        background: red;
      }
    </style>
    </head>
    <body>
      <header>
        <h1>I am a header</h1>
      </header>
      <article>
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce a ligula dolor.
        </p>
      </article>
      <footer>
        <h4>I am a footer</h4>
      </footer>
    </body>
    </html>
    

    That works on all modern browsers (FF4+, Chrome, Safari, IE8 and IE9+)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My website is setup with the content structure like this <body> <div id=header></div> <div
I would like to make my UITableView Footer stop floating over my content, as
my site has three div elements, header, content and footer. i have a picture
I'm displaying images from outside my web root, like this: header('Content-type:image/png'); readfile($fullpath); The content-type:
I would like to not show the name of each chapter on the header
This is what I would like to do. I would like to load content
I would like to create a webpage with header, footer, left column (25% wide
I have a master page with Header, Menu, Content and Footer panes in my
Header, footer and sidebars have fixed position. In the center a content area with
I am using this for sending file to user header('Content-type: application/zip'); header('Content-Length: ' .

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.