Grow your CSS skills. Land your dream job.

link to specific spot on page

  • # September 13, 2009 at 10:48 pm

    Hi, I’m curious about linking to the middle of a page. Normally when you link within the page you’re on, it takes you to your anchor with the name or id that you specified but it puts that particular section at the top of your browser window. Here’s an example –> http://en.wikipedia.org/wiki/David_bowie. When you click on "1947–67: Early years" in the contents box, it takes you to that part of the page, but it puts "1947–67: Early years" at the very top of the page.

    I don’t want that. I want to skip to a particular section but have that section appear in the middle of the page… or even better, at a particular distance from the top of the browser window.

    Any help would be greatly appreciated.

    Thanks,

    Ryan

    # September 14, 2009 at 1:29 am

    just put the anchor above the section that you want. If you want a particular section to be in the middle of the page, then put that section in the middle and then put the anchor at the top of the page. Problem solved, no javascript needed

    # September 14, 2009 at 2:31 am

    I’m going to <a href="#middle">link</a> to an item in the middle of the page!

    ….

    ….

    <a name="middle"></a>This is the middle of the page!

    ….

    ….

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".