HTML a tag (anchor tag)

<A> Tag in HTML

In previous post, we had discussed about <!DOCTYPE> declaration.

Here we will discuss about <a> tag

Anchor Tag in HTML

The HTML <a> element (or anchor Tag) creates a hyperlink to other files, web pages, locations in the same page, email addresses, or any other URL.

<html>
<head>
<title>This is anchor tag practice</title>
</head>
<body>
<a href=”www.webinfosolution.in/a-tag”>Click to see anchor tag tutorial</a>
</body>
</html>

The Output of above code is mentioned below figure. The blue content in below mentioned figure is hyperlinked.  You can run above code on browser and click the blue content. This content will take your screen to the new url. 

a tag in html

A Tag Attributes:

Attribute

Value

Description

charset

char_encoding

It defines the character-set of a linked document

cords

coordinates

It defines the coordinates of a link

href

URL

It defines the URL of the page the link goes to

hreflang

language_code

It describe the language of the document which is linked

name

section_name

It specifies the name of an anchor

Ping

list_of_URLs

It shows a space-separated list of URLs, when the link is followed, post requests will be sent by the browser (in the background).

Rel

alternate
author
bookmark
external
help
license
next
nofollow
noreferrer
noopener
prev
search
tag

It shows the relationship between the current document and the hyperlinked document

Rev

text

It specifies the relationship between the linked document and the current document

Shape

default
rect
circle
poly

It specifies link shape

Target

_blank
_parent
_self
_top
framename

It specifies where to open the linked document (on same page, new tab etc.)

Type

media_type

It specifies what media type is linked to the document.

Global Attributes of Tag

HTML element’s attributes include the global attributes.

Tips to use <a> Attribute

Tip: We can not use the following attributes: download, hreflang, media, rel, target, and type if the href attribute is not present in <a> Tag.

Tip: A linked page is normally displayed in the current browser window, unless you specify another target.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *