I.Rayetzki I.Rayetzki - 1 year ago 37
CSS Question

Navigation with anchor links does not work

Got 3 navigation options. When I click on them, I want my page to scroll to this item. I did like in tutorials.
Made an anchor link above and named a section, where to move.
But when I clicked on the anchor, my nav went a little bit top and thats all.
That happened with every link I clicked. Help!!

Navs:

<div class="bar" id="about"><a href="#about"><b>About</b></a></div>
<div class="bar" id="skills"><a href="#skills"><b>Skills</b></a></div>
<div class="bar" id="contacts"><a href="#contacts"><b>Contacts</b></a></div>

Sections:

<h3 class="about_head"><a id="about">Some facts about me</a></h3>
<h3 class="skills_head"><a id="skills">Langugages and Tools i'm familiar with</a></h3>
<h3 class="postcard_head"><a id="contacts">Leave your feedback</a></h3>

Answer Source

Remove id from all the div tags, it will work

<div class="bar"><a href="#about"><b>About</b></a></div>
<div class="bar"><a href="#skills"><b>Skills</b></a></div>
<div class="bar"><a href="#contacts"><b>Contacts</b></a></div>

<div class="bar" id="about"><a href="#about"><b>About</b></a></div>
<div class="bar" id="skills"><a href="#skills"><b>Skills</b></a></div>
<div class="bar" id="contacts"><a href="#contacts"><b>Contacts</b></a></div>