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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:04:26+00:00 2026-05-27T04:04:26+00:00

Links within a page scroll your content to the top of the browser window.

  • 0

Links within a page scroll your content to the top of the browser window. Is there any way to add a margin to that? I’ll be using some javascript to guide the scrolling, but would like to have a viable fallback.

So, in short, can I add a margin in CSS that will add some space inbetween the top of the browser window and a section when it’s a page link.

HTML:

<nav>
    <a href="#test">TEST</a>
</nav>
<div class="section">
    <a name="test"></a>
    <p>This content should be offset from the top of the page when scrolled to</p>
</div>
  • 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-27T04:04:27+00:00Added an answer on May 27, 2026 at 4:04 am

    the preferred way to do in-page links is to use the id instead of name attribute.

    <a href="#test">
    

    should match up with:

    <div id="test">
    

    From here you can easily add padding to the top of the #test div and that will be your scroll position.

    Example: http://tinkerbin.com/EvV7byy9

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

Sidebar

Related Questions

I'm looking for a way to find/replace links to images (within user-generated content) without
I have a script that parses an html page for all the links within
I want to create a number of links within a page that have different
Working with PHP Xpath trying to quickly pull certain links within a html page.
With Twitter Bootstrap 2, how do get links working within collapse-nav: <div class=navbar navbar-fixed-top>
I am attempting to scroll the window to a location on my page based
I have links within my footer, which when they are clicked, reveal hidden content.
I'm trying to add a Scroll to Top button at the bottom of a
I have a number of list items that contain images within links. When one
After much research, I have learned that binding the scroll event to the $(window)

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.