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

Images don't appear

Have started Basic Web Design, have downloaded text editor and have files from class in folder - have named that folder Treehouse. Have tried both <img src="img/logo.gif" alt="Smells Like Bakin"> and <img src="Treehouse/img/logo.gif" alt="Smells Like Bakin"> and don't get the logo on my webpage. Have also tried to download photos for cupcake without success Am working on a PC with Firefox

9 Answers

John Steer-Fowler
PLUS
John Steer-Fowler
Courses Plus Student 11,734 Points

Hi again Bronwyn,

This is what should happen:

  • You should have one folder somewhere on your computer that by convention should be named after your project, eg 'Smells Like Bakin'
  • Within this folder you should have your index.html file, your other .html files and folders called 'img' and 'css'.
  • The 'img' folder should contain all images used in the website
  • The 'css' folder should contain all .css files used for the website

This makes it easier to know exactly where to source your css and images from.

<img src="img/logo.gif">
<link type="text/css" rel="stylesheet" href="css/main.css">

If you take a look at this code, you will notice that the src="" has img/ and css/ - This is telling the browser to source the image and css from those folder.

I hope this makes sense, I may be repeating myself :D

James Barnett
James Barnett
39,199 Points

Check out the Treehouse blog post helpfully entitled How to Fix a Broken Image.

If you've still got questions after you read through that post your code here. For some tips on how to do that, check out the tips for asking questions video located in the right hand sidebar.

John Steer-Fowler
PLUS
John Steer-Fowler
Courses Plus Student 11,734 Points

Hi Bronwyn,

Within your Treehouse folder, do you have a folder containing the images? This folder might be called something like 'img' or 'imgs'.

To make the images appear, you must source the images using the correct 'path', the syntax looks something like this:

<img src="img/logo.gif" alt="Bronwyn's Website">

In this HTML code, we are searching for the images in the 'img' folder for an image named 'logo.gif'. Please change this code accordingly for the 'path' of your image.

Hope this helps :D

Hi John

I do have a folder containing the images and have used that syntax ie <img src="img/logo.gif" alt="Smells Like Bakin"> I have also tried <img src="Treehouse/img/logo.gif" alt="Smells Like Bakin"> The webpage just shows Smells Like Bakin as text - can't work out what I'm doing wrong

A screenshot for you https://www.dropbox.com/s/dzc8k4zlxl8glyv/Screenshot%202014-02-26%2017.06.30.png Sorry also don't know how to show the html code I'm writing on this forum...

James Barnett
James Barnett
39,199 Points

The forum uses markdown to correctly format code, check out this thread on how to type code in the forum for some examples.

John Steer-Fowler
PLUS
John Steer-Fowler
Courses Plus Student 11,734 Points

Hi Bronwyn, when writing a comment, you will see a link below to 'Markdown Cheatsheet'. This will show you how to show the html

Hi John Will check the cheatsheet for clues, in the meantime I have worked out how to acces the images and css - it is making an html page that is saved in the same folder and so is in Documents and Settings on my hard drive - is that what should happen? Apologies if my questions are pretty basic but this is my first attempt at a site.

Cheers John - it appears I am making (slow) progress!

John Steer-Fowler
John Steer-Fowler
Courses Plus Student 11,734 Points

Your doing fine. Everyone has a problem with broken links when they start out (I obviously did).

You will be great :D I hope your enjoying it despite the issues :D