What is name attribute of anchor tag?plz explain in detail? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is name attribute of anchor tag?plz explain in detail?

7th Sep 2018, 7:41 PM
Afreen
Afreen - avatar
4 Answers
+ 2
Hi Afreen Saba, By including anĀ anchor tagĀ within a post or page, you can place links in the body of your page which when clicked allow the reader/user to jump to another location on the page. # equals the name attribute Syntax: (== is equal to) #value == name="value" # == name value == value <li><a href="#linkOne">Link one</a></li> <li><a href="#linkTwo">Link two</a></li> <div><a name="linkOne">Anchor one</a></div> <span><a name="linkTwo">Anchor two</a></span> Name attribute of anchor tag explainedšŸ‘: https://www.expression-web-tutorials.com/anchor-tags.html Have a look at this sourcešŸ‘: https://stackoverflow.com/questions/484719/should-i-make-html-anchors-with-name-or-id Additional sources: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
7th Sep 2018, 9:53 PM
šŸŒ“Vincent BergeršŸŒ“
šŸŒ“Vincent BergeršŸŒ“ - avatar
+ 2
Name attribute in anchor tag is obsoleted in HTML5, use id # instead. More information please check https://www.w3.org/TR/html5-diff/ " The following attributes are allowed but Web developers are discouraged from using them and instead strongly encouraged to use an alternative solution: TheĀ borderĀ attribute onĀ img. It is required to have the value "0" when present. Web developers can use CSS instead. TheĀ languageĀ attribute onĀ script. It is required to have the value "JavaScript" (case-insensitive) when present and cannot conflict with theĀ typeĀ attribute. Web developers can simply omit it as it has no useful function. TheĀ nameĀ attribute onĀ a. Web developers can use theĀ id attribute instead. "
8th Sep 2018, 12:35 AM
CalviÕ²
CalviÕ² - avatar
+ 2
Hi,Vincent Berger Thank you for explaining. šŸ˜„šŸ˜„
8th Sep 2018, 3:46 AM
Afreen
Afreen - avatar
+ 1
Calvin thanks for giving me the answer
8th Sep 2018, 10:45 AM
Afreen
Afreen - avatar