+ 1

How does <a href="#"> Work?!

I seen a code where it didn't have any J.s and they used <a href="#id"> as onclixk event. I tried doing it and it didn't work... And on this code I was working on, I had <a href="#"> Ginfio </a>. When you click on Ginfio, the screen moves up and I'm not sure how it's doing that. Here's the code, click on Ginfio and the 'Ginfio' is all the way @the bottom. Click on it and you'll see the screen move. How? https://code.sololearn.com/WIMW1B0B2R6T/?ref=app It's not a big deal that the screen is moving, I'm just curious how it is moving with #.

31st May 2019, 6:26 AM
Ginfio
Ginfio - avatar
3 Antworten
+ 6
# is used to go to a certain element with a specific id. But just a hash is basically a link to the top of your page.
31st May 2019, 6:40 AM
Dragonxiv
Dragonxiv - avatar
+ 4
Example. <p id="first"> <a href="#first">
31st May 2019, 7:54 AM
Nabï ⚽
Nabï ⚽ - avatar
0
ahh, make sense.
31st May 2019, 6:41 AM
Ginfio
Ginfio - avatar