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
Caryn Kleinman
471 Pointstrouble 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
Stone Preston
42,016 Pointsyouve 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.
Caryn Kleinman
471 PointsCaryn Kleinman
471 PointsI 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!
Stone Preston
42,016 PointsStone Preston
42,016 Pointsso the tag would be something like
<body> <img src="img/cupcake.jpg width=100 height=100>
</body>
Caryn Kleinman
471 PointsCaryn Kleinman
471 PointsI got it right this time!!
<img src="img/cupcake.jpg">
Thanks again for your help!
Stone Preston
42,016 PointsStone Preston
42,016 Pointssorry I posted a code snippet but I guess they dont show up in discussions, only answers. Glad you got it working
James Barnett
39,199 PointsJames Barnett
39,199 PointsStone Preston
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.
Stone Preston
42,016 PointsStone Preston
42,016 PointsI 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 snippetStone Preston
42,016 PointsStone Preston
42,016 Pointshmm maybe I didnt indent 4 or something
James Barnett
39,199 PointsJames Barnett
39,199 PointsI 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.