What is the use of anchor tag? And what is the syntax of anchor tag | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is the use of anchor tag? And what is the syntax of anchor tag

25th Dec 2016, 8:23 AM
Swati Jain
Swati Jain - avatar
5 Answers
+ 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>
25th Dec 2016, 8:51 AM
Hyper Late Night Code
Hyper Late Night Code - avatar
+ 4
nice thank u
25th Dec 2016, 8:50 AM
Swati Jain
Swati Jain - avatar
+ 3
Hats off sir great answer u cleared my all doubts. I had also the same ques
5th Jan 2017, 7:03 AM
Avi Katyura
Avi Katyura - avatar
0
Hii
28th Jan 2017, 3:42 PM
Asish kumar panigrahi
Asish kumar panigrahi - avatar
0
Thank you 😇🌼 It was anonymously a great answer 😊
14th Jun 2020, 4:36 PM
Vivonuo Kar
Vivonuo Kar - avatar