Why # is used here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why # is used here

5th Apr 2017, 2:58 AM
Meghana Venkatraman Patgar
Meghana Venkatraman Patgar - avatar
6 Answers
+ 14
It's a "fragment" or "named anchor". You can you use to link topartof a document. Typically when you link to a page, the browser opens it up at the top of the page. But you link to a section half-way down, you can use the fragment to link to that heading (or whatever). If there is no<a name="whatever"/>tag within the page, then the browser will just link to the top of the page. If the fragment is empty, then it will also just link to the top of the page. For a fragment only <a href="#">Link name</a> then that's just a link to the top of the current page.You often see that kind of link used in conjuction with javascript. Standards compliant HTML requires a href attribute, but if you're planning to handle the request with javascript then "#" serves as a reasonable place holder.
5th Apr 2017, 3:07 AM
Agus Mei
Agus Mei - avatar
5th Apr 2017, 3:08 AM
Ashwani Kumar
Ashwani Kumar - avatar
+ 3
Where ?? Write some explanation please.
5th Apr 2017, 3:03 AM
Ashwani Kumar
Ashwani Kumar - avatar
+ 2
href="#" => point to same page. when u click it will come to same page.
5th Apr 2017, 3:07 AM
Eranga
Eranga - avatar
+ 1
<nav> <ul> <li><a href="#">Home</a></li> <li><a href="#">Services</a></li> <li><a href="#">About us</a></li> </ul> </nav>
5th Apr 2017, 3:05 AM
Meghana Venkatraman Patgar
Meghana Venkatraman Patgar - avatar
+ 1
thank you
5th Apr 2017, 1:50 PM
Meghana Venkatraman Patgar
Meghana Venkatraman Patgar - avatar