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

Give the image tag...I put in src="images/spain.jpg". Its not working.

Is there something wrong with this portion of this task or did I do it wrong somehow?

index.html
<!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>

2 Answers

I just entered the same:

<img alt="A picture of me in Spain" src="images/spain.jpg">

and it passed the task. Try deleting what you added and type it again, you may have included some hidden characters by mistake.

Aaron Loften
Aaron Loften
12,864 Points

Yeah, I copy and pasted the op's original <img tag and I second this. It looks like you hit a random glitch. Maybe a random no-width-space character fell in there or something and it messed up your code and fixed itself when you copy and pasted. Try it again and it should work. :)

vidyadhar sharma
vidyadhar sharma
1,917 Points

hey!

There were a few issues with your html syntax. I've tried fixing the issues and have created a button script for you that takes you to the top. Try it out. Please note that I've put a different image path for reference. You may replace it with your own image path. Happy learning!

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

  <figure>
    <img src="http://placeimg.com/640/480/people" alt="A picture of me in Spain">

    <figcaption>
    Here is a picture of me in Spain last summer!
    </figcaption>
  </figure>

    <button onclick="topFunction()" id="myBtn" title="Go back to the top of the page">Top</button>
    <script>
window.onscroll = function() {scrollFunction()};

function scrollFunction() {
    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
        document.getElementById("myBtn").style.display = "block";
    } else {
        document.getElementById("myBtn").style.display = "none";
    }
}

function topFunction() {
    document.body.scrollTop = 0;
    document.documentElement.scrollTop = 0;
}
</script>

  </body>
</html>