Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Linking Images using Sublime Text 2

Dear Forum,

I am a novice and taking the treehouse tutorial, "Build A Simple Website". I am using Sublime Text 2, Windows 8, and Chrome, however, when I replicate the code from the tutorial, I can't seem to make the images appear in my Chrome? Text is successful.

I have downloaded the images into my computer.

Any suggestions would be greatly appreciated! And thank you in advance!

20 Answers

Mackenzie Child
Mackenzie Child
4,468 Points

Most likely the source path to your image is wrong. You just need to make sure you have the correct path within your working directory.

So if you are working out of your index.html file, and your image is within an 'images' folder, than your path would be;

<img src="images/example.jpg" alt="Example Image" height="50" width="50">

If you are linking from a css file that is located in a 'css' folder within your directory, you would then need to move up a level by using the '../'.

<img src="../images/example.jpg" alt="Example Image" height="50" width="50">

Thank you so much for your reply Mackenzie! I will try this...

I still cannot get any image to appear in the Chrome HTML document?

I have tried your recommendation above.

I have Windows 8, Chrome HTML document, and Sublime Text 2.

Any suggestions? Thanks!

Mackenzie Child
Mackenzie Child
4,468 Points

Your codes not showing up...

<img src="img/logo.gif" alt="Smells Like Bakin">

Mackenzie, I'm trying my best to show you my code...one moment...

<img src="img/logo.gif" alt="Smells Like Bakin">

<img src="img/logo.gif" alt="Smells Like Bakin">

To post my code I have tried copy/paste..no luck, see my post above is blank?

I have tried to type the code out...no luck, see my post above is blank?

How are you able to highlight your code above and successfully post it?

thanks!

<img src="img/logo.gif" alt="Smells Like Bakin">

<img src="img/logo.gif" alt="Smells Like Bakin">

<img src="img/logo.gif" alt="Smells Like Bakin">

Mackenzie Child
Mackenzie Child
4,468 Points

Look at the Markdown Cheatsheet under the reply box.

<img src="img/logo.gif" alt="Smells Like Bakin">

here is my code: (copied from the tutorial)

<img src="img/logo.gif" alt="Smells Like Bakin">  

This code should show the code...

are you sure of your files and folders and its name? maybe something's wrong with that...

Mackenzie Child
Mackenzie Child
4,468 Points

I agree with @Mohammad.. Double check your directory structure and file & folder names to be sure.

Mackenzie, Mohammad,

I now have successful images.

It was the file path.

Thank you again for your replies! Kevin

James Barnett
James Barnett
39,199 Points

Kevin -

<img src="img/logo.gif" alt="Smells Like Bakin">

What this is telling the browser in plain English is ...

Look for a directory named img which is inside the directory which has the HTML file then look for a file named logo.gif.

So if you didn't unzip those directories and create a directory structure the same as Nick did in the video, that could be your issue.


If you are still having trouble, the issue is most likely path-related.

Read through these 2 articles on how file paths work:

Let us know if are still having issues after reading those articles.

Matt Trask
Matt Trask
10,027 Points

Can you help me create a file directory? I am having the same issue as OP but I cant figure out how to create my own directory. I have all the files downloaded right off the website and have them in a file. But how do I create a directory to help out?

Ok, this helped me with the exact same problem, just wanted to say my thanks to you guys, newbie right here and glad to see that people are helping each other out!

Garrett

Was having the same issue, thank you for the info.