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

CSS How to Make a Website Adding Pages to a Website Style New Pages

img

having a problem with adding pictures on my website

<section> <img src="img/numbers-01.jpg" alt="beutifull"> i dont know what is wrong i tried to use textmate and sublime text and both won't show the image

14 Answers

Hi,

If you have uploaded your image to a folder, e.g. images the HTML for your image should look something like the below:

<img src="images/your-image-name.jpg" alt="My image">

If you're referencing it from within another folder you may need to add either ../ or a / to the beginning of the src path so that it is relative to the root (this may not work locally though).

Could you try checking the following to see if this helps please?

  • Your image has been added to your website folder
  • Your path matches this folder structure, e.g. images/your-image-name.jpg
  • Your image file extension is included/correct, e.g. .jpg, .gif, etc.

Without seeing the code I can't be sure of the issue but hopefully this should help to narrow it down. If this doesn't resolve the issue could you post the problem HTML please?

Thanks

-Rich

Are you sure you have written the src attribute right?

<img src=""> and inside the quotes goes the path to your image

Post your html on here it's possible you missed typed something wrong. Everyone on here covered what the issue may be already.

Or if you are using the files you downloaded and have yet to start working in them many times the images are not added until you move further along the video. You would have to add them yourself later on.

Here is a quick guide on how you should write your code on the forum.

Code block on Treehouse

If you are using a Mac the bactick is on the bottom.

i already solved thanx

i downloaded the project files it still not working i don't know what is wrong i coded like this

<img src="img/numbers-01.jpg>

EDIT. I fixed your code. Please click edit and see what I did so that your code shows up properly.

Basicly, there cant be many options what you did wrong.

  1. If your html file and image are in the same folder

    <img src="imageName.jpg">
    
  2. If your image is in a seperate folder

    <img src="folderName/imageName.jpg">
    
  3. If html is in one folder, and image in other, you first need to leave html folder and then enter img folder

    <img src="../folderName/imageName.jpg">
    

Check if you wrote the right image extenstion (jpg, png..) , if you wrote the image and folder names correctly, and make sure to put = after src (src="")

EDIT : you havent closed the quotation after jpg ;)

Becky Christofferson
Becky Christofferson
15,047 Points

It looks like you are missing the quotation mark after the img url.

thanx guys now i can add images to my website

No problem, glad you got it sorted.

-Rich

another question when i add my about.html page it gives me an error that the page is not available

This webpage is not found

Hide details No webpage was found for the web address: file:///Users/abdiali/Desktop/about.com Error code: ERR_FILE_NOT_FOUND

You seem to be looking for about*.com* instead of about*.html*.

-Rich

even when i click my home page it gives me the same error any idea what is missing...

i saved about.html

i saved about.html

when i refresh it searches as you said about.com

Are you clicking through to this from a link or adding it via an address bar in your browser?

-Rich

i got sorted it out thanks once more i made a mistake.... i wrote like this

<a href="index.com">
instead of <a href="index.html>

Ok no problem, don't forget to mark whichever answers solve your original issue as 'Best Answer' so others can quickly see a solution :)

Thanks

-Rich

Can you show us how you have it linked on your html. From what I can tell your link should Include your websites name(folder you have all html inside off) right after desktop/ then it should be about.html

Also how did you save your files? They should end with .html

i already solved thanx