+ 5
What is the use of anchor tag? And what is the syntax of anchor tag
5 Réponses
+ 8
Anchor tags are an important element in (typically) HTML navigation content, allowing the user to get directed back and forth between certain locations of the page, or to another website.
Syntax is as follows:
<a href="hyperlink">Text here represents the hyperlink</a>
The W3C specification states:
"If the <a> element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.
If the <a> element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element’s contents."
Examples:
<a href="http://www.sololearn.com">Everyone can code</a>
("Everyone can code" is clickable and directs to the referred site in the attribute)
<a href="images/a.gif">This image</a>
(a relative link to an image)
<a href="#bottom">Go to bottom</a>
(at the end of your document)
<a name="bottom">
Remember to use the pound symbol (#) for linking to placeholders.
Optionally, you can add the following attribute which will make the link open in a new tab/window (depending on the user's browser configuration):
<a href="" target="_blank"></a>
+ 4
nice thank u
+ 3
Hats off sir great answer u cleared my all doubts. I had also the same ques
0
Hii
0
Thank you 😇🌼
It was anonymously a great answer 😊