loader

Loading

CoderrShyam logo

CoderrShyam

HomeAboutContactBlogTutorials
LoginSignup

Getting Started

Quick Start

HTML Basic

Skeletal TagsHeading TagsParagraph TagLine Break TagHorizontal Line TagAnchor TagImage TagPre Tag

Head Elements and Media

Advanced Concepts

CoderrShyam logo

CoderrShyam

HomeAboutContactBlogTutorials
LoginSignup
TutorialsHTML TutorialBasic tagsAnchor Tag

Anchor Tag

The `<a>` tag in HTML is used to create hyperlinks or anchor links to other web pages or resources. Learn how to use the `<a>` tag to create links in HTML.

Key Characteristics of HTML Links

  • Specified by the <a> tag.
  • Also known as hyperlinks.
  • Used to link one document to another.
  • Includes a closing tag </a>.

Syntax: Anchor Tag

<a href="Your specified path"> Your link text </a>

Essential Attributes

HTML links primarily use two attributes:

  • href: Specifies the URL of the page the link goes to.
  • target: Specifies where to open the linked document.

Target Attribute Values

  • _blank: Opens the linked document in a new window or tab.
  • _top: Opens document in the full body of the window.
  • _self: Opens document in the same window or tab (default behavior).
  • _parent: Opens the linked document in the parent frame.

Linking to Specific Page Sections

To link to a specific section of a webpage, you can:

  • Use the name or id attribute of the target section.
  • Use a hyperlink with a hash (#) followed by the target id or name.

Example

Let's say you have a long webpage with multiple sections, and you want to create a link at the top that, when clicked, takes the user directly to a specific section further down the page. You can do this using HTML links that target specific sections.

<!doctype html>
<html>
  <head>
    <title>My Webpage</title>
  </head>
  <body>
    <!-- Link at the top -->
    <a href="#gardening-tips">Go to Gardening Tips</a>

    <!-- Some content -->
    <p>Here is some other content...</p>

    <!-- Gardening Tips Section -->
    <h2 id="gardening-tips">Gardening Tips</h2>
    <p>This section provides tips on how to garden...</p>
  </body>
</html>

Link Colors

Links typically appear in different colors based on their state:

  • Unvisited Links: Shown as blue and underlined like this sentence
  • Visited Links: Appears purple and underlined like this sentence
  • Active Links: Displayed in red and underlined like this sentence

You can customize these colors using CSS to better match the style of your website.

How is this guide?

February 26th, 2026

Horizontal Line Tag

The `<hr>` tag in HTML is used to create a horizontal line or rule on a web page. Learn how to use the `<hr>` tag to separate content and create visual divisions in HTML.

Image Tag

The `<img>` tag in HTML is used to insert images on a web page. Learn how to use the `<img>` tag to display images in HTML.

© 2026CoderrShyamAll Rights Reserved.

On this page

Key Characteristics of HTML Links
Syntax: Anchor Tag
Essential Attributes
Target Attribute Values
Linking to Specific Page Sections
Example
Link Colors
Follow us on GitHub