+ 1
What does "#" do after href?
7 Answers
+ 7
If you mean this syntax: <a href="#">A link</a>, it has nothing to do with IDs. The '#' is used here as placeholder instead of real link/url. It makes a link clickable without taking you anywhere. Good for practicing and testing.
When you assign an ID to <a>, it will look like this:
<a id="fancy" href="#">link text</a>
The CSS is where you use '#':
a#fancy { color: orange; }
+ 1
if you want to keep the user on same page even after clicking that anchor then you can use # after href like
<a href="#" >anchor</a>
0
when you link using id then u have to use # In href.
0
can I have an example please?
0
in css # is use to refer for id and . for class
eg
# {color:black;} change the color of the p tag.
0
placeholder, means to Shang the # to ur link
- 2
if you want to link with id's like
<p id="hello">hello world</p>
<a href="#hello">click</a>
mostly it's used in one page website or application