Computer Science, asked by rohitkumar2319, 10 months ago

explain anchor tag along with it's attribute ​

Answers

Answered by charlie1505
4

Answer:

An anchor is a piece of text which marks the beginning and/or the end of a hypertext link.

The text between the opening tag and the closing tag is either the start or destination (or both) of a link. Attributes of the anchor tag are as follows.

eg-

<a href="http://www.example.com">My sample page </a>

href attribute-

To create a hyperlink, the destination (address) of the document must be known. A hyperlink can link to pages on your own domain, to other websites, or to a file

eg-

<a href="http://www.google.com">Google Home</a>

Name attribute-

The name attribute of the anchor tag can be used to enable users to “jump” to a specific point on a page (jump marker, anchor). This is especially useful with large pages or subdivisions.

eg-

<a name="to top"></a>

You can also link to a specific location on another page internally. This would be defined as follows:

<a href="anotherpage.html#name">Linktext</a>

Target attribute-

The target attribute specifies how the destination page or the target document should be opened. “target=” _ blank “ is used for opening of the target page in a new tab. This is the usual option when using target attributes for linking to other pages.

<a href="http://www.mypage.com" target="_blank" rel="noopener">Linktext</a>

Title attribute-

The title attribute gives users an important indication as to where they will be directed to when they click on a link. If the user hovers with the mouse over a link reference, the title text, which was defined in the attribute, will be displayed. This can be a tool tip, or description of the resource to which the link directs. The data from the title attribute makes the site more user-friendly.

eg-

<img title="Here you can see a sample image" src="exampleimage.png" alt="sample image">

Similar questions