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

Daniel Zimmerman
Daniel Zimmerman
210 Points

I cannot get the photo.

Here is the code. is it wrong?

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

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

</body> </html>

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

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

  </body>
</html>

3 Answers

You forgot the alt attribute. :-)

Yours:

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

With alt attribute:

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

Thats probably also why the apostrophs are automatically a little highlighted in your code by the editor...

Daniel Zimmerman
Daniel Zimmerman
210 Points

Thank you Nils. I'll give that a go. Cheers!

Another thing that you should do is to wrap the text β€žHere is a picture of me in Spain last summer!β€œ in an element tag.

The browser will still display the text even without tags but it has no semantic meaning at all.

You could use the paragraph tag <p> for example. That would be the easiest for the beginning.

Later if you want the text to be a caption of the image you could use the <figure> and <figcaption> elements, like this:

<figure>
  <img src="image-name.jpg" alt="image description">
  <figcaption>This images shows blabla...</figcaption>
</figure>