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

trouble with image path

Hello All,

I am in the beginning stages and having some difficulty with image paths. In the Text Editors and HTML chapter I have been able to successfully follow along and code sublime2. However, I am stuck on the code challenge test after this video. <img src="img/logo.gif">

I put in what I think the image path is, but it says it’s wrong. Could someone please explain how paths work regarding images. Thanks, Gerard.

1 Answer

youve got to give the absolute path. so if it says the image is in the images directory of the current project and is named image.png, then the path would be

/images/image.png

if you post the actual question to the challenge I could help you better.

I appreciate your help!!

The question being asked is: "Assuming an 'img' directory with an image 'cupcake.jpg', add the image to the body of the document."

This is what I created: <img src="img/logo.gif" alt="Smells Like Bakin"> It linked correctly in my practice along while watching the video, however it seems to be incorrect in the quiz after the video. I'm confused!

so the tag would be something like

<body> <img src="img/cupcake.jpg width=100 height=100>

</body>

I got it right this time!!

<img src="img/cupcake.jpg">

Thanks again for your help!

sorry I posted a code snippet but I guess they dont show up in discussions, only answers. Glad you got it working

Stone Preston

I posted a code snippet but I guess they dont show up in discussions

Nope, you just have to use markdown for the forum to correctly format your code. Here's a quick primer on how to type code in the forum.

I know how to post code in the forum. I tried posting a code snippet on a discussion, by indenting 4 spaces, and for some reason it doesnt display it

code snippet

hmm maybe I didnt indent 4 or something

I just took a look at your code snippet above you apparently didn't indent the <body> tag.

Also there are easier ways post longer sections of code using code blocks, details and examples in the forum thread I linked earlier.