by skyvia
3 replies
  • WEB DESIGN
  • |
I have a problem with anchoring links.

When I send a link to a div using an anchor it cuts of the top of the page, what is the reason for this?
#anchor #tag
  • Profile picture of the author KathyK
    I assume you have an anchor tag like
    Code:
    <a name="myanchor"></a>
    and then you link to it with
    Code:
    http://mywebsite.com/mypage.html#myanchor
    ?

    If that is the case, it's probably doing what it is supposed to.

    An anchor tag "anchors" a particular part of the page - the page automatically scrolls down to where you put the anchor. If you want things to always start at the top, just use
    Code:
    http://mywebsite.com/mypage.html
    without the anchor.
    Signature

    Cheers,
    Kathy

    {{ DiscussionBoard.errors[3745774].message }}
  • Profile picture of the author gulfhosting
    Banned
    Anchor tag is used for giving link
    {{ DiscussionBoard.errors[3763587].message }}
  • Profile picture of the author JF Garsula
    Are you trying to give a div a link? If so, here's how its done:

    HTML:
    <div id="div_with_link">
    <a href="#">Link in the div</a>
    </div>

    CSS:
    #div_with_link a{display:block;width:100px;height:100px;}

    The tags and css above makes a div with a dimension of 100x100 and its clickable. Though the text will be seen inside the div. If you want to remove it, just add the css: text-indent:-999999px;
    {{ DiscussionBoard.errors[3766775].message }}

Trending Topics