HTML Introduction to HTML and CSS HTML: The Structural Foundation of Web Pages and Applications Test: Creating an HTML Element

anchor tag

how do i set the anchor tag to go back to the top of the page

    <title>My trip to Spain</title>

    <img src="images/spain.jpg">
    <p>Here is a picture of me in Spain last summer!</p>
    <p> <a href="!#top>">Go back to the top of the page.</a></p>


3 Answers

Ryan Groom
Ryan Groom
17,042 Points

Lucia Shimwetheleni Hey Lucia, you're extremely close. Remove the "!" and you should have your solution. an <a href="#top">Go back to top of page</a> should work for you! Let me know if you have any trouble with it.

Bashar Ghadanfar
Bashar Ghadanfar
21,642 Points

Hi Lucia Shimwetheleni

The top element should have the attribute id="top".

And your anchor element should have the attribute href="#top".

4,107 Points

You just need to add this one to your anchor tag: href='#'