www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] Getting Anchors to also display themselves.

  1. #1
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    84

    resolved [RESOLVED] Getting Anchors to also display themselves.

    When clicked, I noticed the anchor point links on my page, jump to the point on the page below the link it was attached to (making it out of sight). I've been trying to get it to also display the anchor part of the page by inserting an empty anchor tag above the point, but hack doesn't work.

    HTML Code:
    <div><a id="some_menu" style="margin-bottom:100px"></a></div>
    <h2><?php echo $lang['some_menu']; ?></h2>
    <p><?php echo $lang['some_text']; ?></p>
    Is there a way I can achieve this?

    Thanks.
    Last edited by leke; 05-29-2013 at 04:18 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    84
    I figured it out
    It just needed some top padding.
    HTML Code:
    <a id="someName" style="padding-top: 50px;"></a>

  3. #3
    Join Date
    Mar 2012
    Posts
    1,197
    You've found a solution, but I doubt that it is the "right" one. I would question why you are using an anchor in the first place? Why not just set padding-top in the heading? e.g.

    <h2 id="my-id" style="padding-top:50px;">some heading</h2>
    Last edited by jedaisoul; 05-31-2013 at 03:23 PM.

  4. #4
    Join Date
    Mar 2010
    Location
    Finland
    Posts
    84
    Thanks

    For some reason, I thought anchors needed the <a>, but turns out not to be so. This way forces there to actually be padding above the header, but it looks ok, so it all worked out.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles