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 trialCarlton Boutwell
109 Pointsgive the image tag a src
im very new to this and guess im not understanding
<!doctype>
<html>
<head>
<title>My trip to Spain</title>
</head>
<body>
<img alt="A picture of me in Spain">
<img 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>
Robert Watkin
733 PointsAs Rafal has shown above you need to have both the src and alt attributes within the image tag. Your first answer had two image tags. One with just the alt attribute and the second just had the src attribute. This technically meant you were trying to add two images; one without a src and one without an alt attribute. I'm also assuming the text "Here is a picture of me in Spain last summer!" is something you want to be displayed on the website. The proper way you should do this is to have that text within a tag. Try a paragraph tag, there are other tags you could use as well such as header tags.
Hope this helps :)
3 Answers
Mohamed Ahmed
7,449 PointsThe right answer should be like that
<!doctype>
<html>
<head>
<title>My trip to Spain</title>
</head>
<body>
<img src= "images/spain.jpg" alt=" Here is a picture of me in Spain last summer!">
<a>Go back to the top of the page.</a>
</body>
</html>
Stephen Bolger
4,505 PointsElements in HTML use attributes to provide necessary and optional information. An image uses the <img> tag and requires the src attribute to state the path to the image -- where the image is in your site's folder structure. You can specify one or more attributes for an element inside the element's opening tag. Also, it's helpful to remember that some elements have an opening and closing tag, and images don't have a closing tag. So, the following shows the src and alt attributes added to the <img> element.
Hope this helps along with the answers already provided.
<img src="images/spain.jpg" alt="A image of me in Spain">
Pepe ToΓ±o
13,815 PointsAll the parameters for an html control in no particular order, in this case "img", goes inside the opening tag "<img>" as everyone answers in their examples. So the correct syntax is <img alt="" src="">
Rafal Dziobek
3,771 PointsRafal Dziobek
3,771 Pointshey there it should have been ;
<img src= "images/spain.jpg" alt="A picture of me in Spain">