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
Susan De Stephanis
485 PointsNeed assistance with a code challenge..
I am trying to get past the Web Design, Text Editors and HTML, Code Challenge 2 of 4. The question is: We've placed an image named 'cupcake.jpg' in a directory named 'img'. Add the image to the body of the document.
I typed in the text, check it, and this is the message that I get (screen shot is unavailable):
Bummer! Double-check your image path.
PreviewRecheck work
index.html
1 <!DOCTYPE HTML>
2 <html>
3
<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5 <title>Smells Like Bakin' Cupcake Company</title>
6 </head>
7 <body>
8 <img src="img/logo.gif alt=Smells Like Bakin">
9 </body>
10
11 </html>
12 Please advise. Thank you!
4 Answers
eirikvaa
18,015 PointsThe correct way of inserting an image is like this:
<img src="image_path" alt="alternative_text" />
In this case you would insert "img/cupcake.jpg" where it says "image_path". I don't think you need to add an alternative text, but it's best practice anyway.
Susan De Stephanis
485 PointsThank you!
Sebastien Ferre
3,319 PointsHi Susan,
here is what your code should look like :
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Smells Like Bakin' Cupcake Company</title>
</head>
<body>
<img src="img/cupcake.jpg"/>
</body>
</html>
you should add title tags to "Smells Like Bakin' Cupcake Company" and include your image relative path into an image tag. I hope this helps.
Susan De Stephanis
485 PointsThank you for your help.