Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

What is an anchor tag in HTML and what are its attributes?

Can you please tell me what an anchor tag in HTML is and what are its attributes?

6 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    The Anchor Tag and the Href Attribute

    HTML uses the <a> (anchor) tag to create a link to another document.

    An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc.

    The syntax of creating an anchor:

    <a href="url">Text to be displayed</a>

    The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink.

    This anchor defines a link to W3Schools:

    <a href="http://www.w3schools.com/%22%3EVisit W3Schools!</a>

    The line above will look like this in a browser:

    Visit W3Schools!

    --------------------------------------------------------------------------------

    The Target Attribute

    With the target attribute, you can define where the linked document will be opened.

    The line below will open the document in a new browser window:

    <a href="http://www.w3schools.com/%22

    target="_blank">Visit W3Schools!</a>

    --------------------------------------------------------------------------------

    The Anchor Tag and the Name Attribute

    The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for.

    Below is the syntax of a named anchor:

    <a name="label">Text to be displayed</a>

    The name attribute is used to create a named anchor. The name of the anchor can be any text you care to use.

    The line below defines a named anchor:

    <a name="tips">Useful Tips Section</a>

    You should notice that a named anchor is not displayed in a special way.

    To link directly to the "tips" section, add a # sign and the name of the anchor to the end of a URL, like this:

    <a href="http://www.w3schools.com/html_links.asp#tips%22%3E

    Jump to the Useful Tips Section</a>

    A hyperlink to the Useful Tips Section from WITHIN the file "html_links.asp" will look like this:

    <a href="#tips">Jump to the Useful Tips Section</a>

    --------------------------------------------------------------------------------

    Basic Notes - Useful Tips

    Always add a trailing slash to subfolder references. If you link like this: href="http://www.w3schools.com/html%22, you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this: href="http://www.w3schools.com/html/%22

    Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.

    If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs.

  • ?
    Lv 4
    4 years ago

    Anchor Tag Attributes

  • Anonymous
    5 years ago

    Hi, This can only be done in CSS however you can put your CSS code in the anchor tag like this: <a href="URL" title="" style="text-decoration:none;">Anchor Text</a> I hope this would help.

  • 7 years ago

    Ok, lets see if this works...

    <a href="http://www.justgreatvalues.com/page/480663590/%22%... Text</a>

  • How do you think about the answers? You can sign in to vote the answer.
  • Anonymous
    1 decade ago
Still have questions? Get your answers by asking now.