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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:35:35+00:00 2026-06-01T12:35:35+00:00

I want to make a website where the (dynamic in height) header and footer

  • 0

I want to make a website where the (dynamic in height) header and footer have a fixed position. The content should start directly beneath the header. I made a quick example. (Yellow and red top positions are the same, I want the yellow DIV to start beneath the red DIV.)

If you set the header position to fixed, the content DIV is placed at the same top position of the header.

For example, if you use float, you can use clear: both to reset the position, is there also a possibility for position: fixed?

  • 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-06-01T12:35:36+00:00Added an answer on June 1, 2026 at 12:35 pm

    CSS Only Solution

    Use some way to pad the space the header takes up at the top of the screen:

    • padding-top:
    • margin-top:
    • position:relative + top:

    Then have a separate CSS style sheet to change height for regular viewports versus mobile viewports.

    (Or see below for JavaScript solution to set the height attribute dynamically.)

    • jsFiddle

    HTML:

    <html>
      <body>
        <div id="header">
          Header
        </div>
        <div id="wrapper">
          <p>First Row</p>
          <p>Next row</p>
          <p>...</p>
          <p>Last row</p>
        <div>
      </body>
    </html>
    

    CSS (regular version):

    #header {
      position:fixed;
      height:100px;
      width:100%;
      background-color:green;
      color:white;
    }
    #wrapper {
      position:relative;
      top:101px;
    }
    

    CSS (mobile version):

    #header {
      height:50px;
    }
    #wrapper {
      top:51px;
    }
    

    JavaScript Solution

    HTML (copy-and-paste-able):

    <head>
      <style>
        #header {
          position:fixed;
          height:100px; /* try different values here! */
          width:100%;
          background-color:green;
          color:white;
        }
        #wrapper {
          position:relative; /* look Mom no height! */
        }
      </style>
    </head>
    <html>
      <body>
        <div id="header">
          Header
        </div>
        <div id="wrapper">
          <p>First Row</p>
          <p>Next row</p>
          <p>...</p>
          <p>Last row</p>
        <div>
        <script language="javascript">
          document.getElementById('wrapper').style.top = String(document.getElementById("header").offsetHeight + 1);
        </script>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this website I am designing and I want to make it to
we have a static, non-wicket CMS website and we want to include a dynamic
I'm want to make website have a textbox and a save button. When you
I have an Asp.net website using SQL Server. I want to make a website
I have 2 servers for my website Web Server For sending dynamic content, mostly
I want to make a basic forum for my website. I have 2 tables
I have a website and I would want to ask users to make my
I want to make relationship between my Facebook Page & my website. I have
I want to make website in multiple languages, I do it right with cookies
I want to make a website in cakephp framework.but the important thing is I

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.