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 trialKirill Solomakha
384 PointsBroken Link, cannot figure out why
The image won't load in the browser, and I'm only getting a broken link. I'm not sure what the issue is, i tried making the "Src" as clear as possible (Documents/Project/img/logo.gif) and as simple as possible. No luck.
EDIT here is the code: <!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/logo.gif" alt="Smells like Bakin'"> </body> </html>
7 Answers
Hayden Taylor
5,076 Pointsimg src="./img/logo.gif"
or if your doing it by css as in a background url it would be background: url('../img/logo.gif');
Notice that the single . means "Current Directory" where as .. means "Step back 1 directory and Use that one"
Kirill Solomakha
384 Points!DOCTYPE HTML html head meta http-equiv="Content-Type" content="text/html; charset=utf-8"/ titleSmells Like Bakin' Cupcake Company/title /head body img src="./img/logo.gif" alt="Smells like Bakin'" /body /html
still no luck
Hayden Taylor
5,076 PointsI wish I could see your folder structure. It may be a name error is the picture a .gif? Also file names are case sensitive which means it needs to be identical.
So I take this is all in your "index.html" file... is that file located in the same place as the "img" folder? because you need to tunnel to that folder. Could you list the files and folders in the same directory as the html file you are working on please
Kirill Solomakha
384 PointsThank you Hayden, that was the issue! I created a new folder and moved both the index.html file as well as the .gif into there. That solved the issue - the src was was just "./logo.gif"
nik
8,925 PointsPost your html code so we can see what it looks like.
Kirill Solomakha
384 Points<!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/logo.gif" alt="Smells like Bakin'"> </body> </html>
That's what I currently have. I tried Hayden's suggestion and that didn't work either.
Hayden Taylor
5,076 Pointsremove the < and > from the tags. treehouse blocks them from being seen
Kirill Solomakha
384 Points!DOCTYPE HTML html head meta http-equiv="Content-Type" content="text/html; charset=utf-8"/ titleSmells Like Bakin' Cupcake Company/title /head body img src="img/logo.gif" alt="Smells like Bakin'" /body /html
Hayden Taylor
5,076 PointsSo as i said above use img src="./img/logo.gif" alt="Smells like Bakin'" and I explained what the . does
Hayden Taylor
5,076 PointsThats great but its important to know all your images should be put into a separate folder such as your "img" folder. So if you don't mind. Where you currently have "logo.gif" put a folder called "imgs" in there and put the picture in there. Change your file path on the img tag src to: "./imgs/logo.gif"