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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:59:53+00:00 2026-05-30T00:59:53+00:00

I have a fixed header height 50px. In my body, I have a lot

  • 0

I have a fixed header height 50px. In my body, I have a lot of anchors. The problem is that, when I click on links pointing to anchors, the anchor appears under my fixed header and I lose 50px of content (I need to scroll up of 50px to read content under the header).

Is there a way to margin an anchor of 50px? My body is filled with a lot of box (divs) with a margin between themself, so I can’t put in place an empty div of 50px and then anchor after it..

html:

<div id="header"></div>
<div id="content">
     <div class="box" id="n1"></div>
     <div class="box" id="n2"></div>
     <div class="box" id="n3"></div>
</div>

css:

#header{
    height: 40px;
    width: 100%;
    margin: 0px;
    padding: 0px;
    position: fixed;
    text-align: center;
    z-index:2;
}

#content{
    padding-top: 50px; 
    margin: 0px;
}

.box {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    vertical-align : top;
    padding: 1.4%; /* Keep it in percent (%) */
    margin-bottom: 30px;
    min-height: 200px;
}
  • 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-30T00:59:55+00:00Added an answer on May 30, 2026 at 12:59 am

    If the header is truly fixed then place your anchors in a scrollable div. Then the div containing the anchor will scroll instead of the entire page. Visit the fiddle and click on anchor1. It goes to anchor2. And so forth.

    http://jsfiddle.net/mrtsherman/CsJ3Y/3/

    css – set overflow hidden on body to prevent default scrolling. Use position absolute on the new content area with top and bottom set. This forces it to stretch to fit the remaining viewport window.

    body { overflow: hidden; }
    #header { position: fixed; top: 0; left: 0; width: 100%; height: 50px; background: gray; border: 1px solid black; }
    #content { 
        overflow: scroll; 
        position: absolute;
        top: 50px;
        bottom: 0px;
        width: 100%;
        border: 1px solid blue; 
    }
    

    html

    <div id="header">header</div>
    <div id="content">
        <div>
            Page Content <br />
            <a id="a1" href="#anchor2" name="anchor1">Anchor 1</a>                
            <a id="a2" href="#anchor1" name="anchor2">Anchor 2</a>   
        </div>
    </div>​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fixed-height (180px) header and fixed-height footer (50px). I'd like the container
I have a fixed-height (180px) header and fixed-height footer (50px). I'd like the container
I have a site that features a fixed header, the problem is that it
I'm interested in the way lala.com works. They have a header that remains fixed
I have a header on my website that is fixed and is say 100px
I have a header tag, with a fixed width, that in some instances will
I'm trying to make a page where I have a fixed height header and
Howdey! Simple problem: I've a fixed header, the height shrinks down based on the
I have a page with a fixed header and below that a table that
If you take a look at: http://www.bendemeerwoolshed.co.nz I have a fixed header. All fine

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.