Anchor Tag

by 3 replies
4
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?
#website design #anchor #tag
  • 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.
  • [DELETED]
  • Banned
    Anchor tag is used for giving link
  • 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;
  • [DELETED]

Next Topics on Trending Feed

  • 4

    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?