Jumping page on portfolio

Jumping page on portfolio
0

#1

Hello everyone,

This is my first time posting a question on this forum. I hope this is the right way to do it.
I am making my portfolio on code pen. Link’s here.
And I am having issue when I try to click a button and have my page scroll to a certain location.
At the top of my page, I have a button called “Middle” which is supposed to scroll to the middle of the page.
button> a href="#middle"> /a> Middle /button>
a id=“middle”>Middle /a>
I had to take “<” out so that the post can show my code.
But I have not been able to make it work. Is there something wrong with my code?


#2

You should enclose your button tags WITHIN the <a> tags and then it works.

You can also simply style your <a> link like a button…or give it a class="btn">, which requires bootstrap.


#3

That worked!!! Thank you so much.

Should I always have other elements enclosed in my anchor elements?


#4

hmmmm I don’t know :blush: I’d say yes but actually it depends on the element.

If you look up the MDN html elements for <a> tags, it will tell you what content it can accept or not…and it seems that button is accepted, so I don’t know.


#5

That helps! Thank you again.