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 trialshueyb abdirizak
1,564 Pointsimg
having a problem with adding pictures on my website
14 Answers
Rich Bagley
25,869 PointsHi,
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
Milan Milosevic
6,647 PointsAre you sure you have written the src attribute right?
<img src=""> and inside the quotes goes the path to your image
Jovanny Elias
16,204 PointsPost 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.
If you are using a Mac the bactick is on the bottom.
shueyb abdirizak
1,564 Pointsi already solved thanx
shueyb abdirizak
1,564 Pointsi 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.
Milan Milosevic
6,647 PointsBasicly, there cant be many options what you did wrong.
-
If your html file and image are in the same folder
<img src="imageName.jpg">
-
If your image is in a seperate folder
<img src="folderName/imageName.jpg">
-
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
15,047 PointsIt looks like you are missing the quotation mark after the img url.
shueyb abdirizak
1,564 Pointsthanx guys now i can add images to my website
Rich Bagley
25,869 PointsNo problem, glad you got it sorted.
-Rich
shueyb abdirizak
1,564 Pointsanother 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
Rich Bagley
25,869 PointsYou seem to be looking for about*.com* instead of about*.html*.
-Rich
shueyb abdirizak
1,564 Pointseven when i click my home page it gives me the same error any idea what is missing...
shueyb abdirizak
1,564 Pointsi saved about.html
shueyb abdirizak
1,564 Pointsi saved about.html
shueyb abdirizak
1,564 Pointswhen i refresh it searches as you said about.com
Rich Bagley
25,869 PointsAre you clicking through to this from a link or adding it via an address bar in your browser?
-Rich
shueyb abdirizak
1,564 Pointsi 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>
Rich Bagley
25,869 PointsOk 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
Jovanny Elias
16,204 PointsCan 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
shueyb abdirizak
1,564 Pointsi already solved thanx
shueyb abdirizak
1,564 Pointsshueyb abdirizak
1,564 Points<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