Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Href="#top"? I've tried literally like 20 times and can't figure it out.

Set the anchor tag so that it points to the top of the page. (Hint: you'll need the href attribute.)

Bummer! You need to set the 'href' attribute of the <a> tag to "#top".

I failed so many times it made me start all three lessons over. Treehouse should make it to where if you can't seem to figure it out, the hints get better.

index.html
<!doctype>
<html>
  <head>
    <title>My trip to Spain</title>
  </head>
  <body>

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

  </body>
</html>

5 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Chandler Cuevas Well you get an A for effort! :thumbsup: I definitely see that you've worked on this. In fact, I think you may have overworked it a bit. I see ending tags for things that are there and src attributes that are now inside of paragraphs instead of being in the image tag.

When a challenge says it loses connection resist the urge to click one of the buttons it offers. Instead, click on the X to take you back to the challenge and do check work again. 9 times out of 10 this will fix the connection issue.

Here are the three lines of code you need:

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

Happy coding! :smiley:

Try this code:

<!doctype>
<html>
  <head>
    <title>My trip to Spain</title>
  </head>
  <body>

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

  </body>
</html>
Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Chandler,

You're on the right track, except you put some <p> tags around the text in the alt attribute, and this is the main thing that is causing your error. Task 2 says to put the text inside of paragraph tags, which you did correctly in the line under the image tag. The second thing is you are missing a closing double quote after #top. Fix up those two issues and you're good to go. :)

Below is the corrected code for your reference.

Edited

<!doctype>
<html>
  <head>
    <title>My trip to Spain</title>
  </head>
  <body>

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

  </body>
</html>
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Jason Anders Hey! As a note, your code as posted doesn't work for the challenge. The challenge explicitly calls for the anchor tag to have the href :smiley:

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hey Jennifer Nordell

Thanks for catching that :smiley:. I'm not sure what happened? I did something funky with the copy/paste from the challenge.

I've edited my answer to reflect the correct code. Thanks again! :thumbsup:

Thanks everybody...I didn't get the notification until now. I was searching the web thinking nobody responded this whole time. =(

Oh that's ok. :smile: