Anchor elements aren't linking to right part of page

Anchor elements aren't linking to right part of page
0

#1

Hello! As you can see from my code, the ‘projects’ button has a href of “#projects”, and so does the element that it’s supposed to link to. However, when I click it, it links to the #about section for some reason, and I can’t understand why. The other two buttons seem to work fine (contact is not yet done).

What should I edit? Or is there something easy that I’m missing?


#2

Hello there… I have tweaked your code and removed the id from section and placed it within the div tag after “See what iv bn up to” statement. You can refer to the picture

. I hope this helps


#3

This is happening because of how you’ve used floats in your css. The #projects section tag is collapsing and sits next to #about.

As soon as I added #projects{clear:both;}, things started working again.


#4

You are eagle eyed:smiley: . Had missed that part…


#5

Thanks for the help!