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

linking images

hie guys can anyone help? i am using sublime text 2 for my practice in front end web development but i cant link images and photos in my hard drive to my project. how do i go about it?

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,254 Points

Hi Vellon,

Could you post your code to the forum, particularly your attempts to link images to your project.

Until then I can only guess what might be going wrong e.g.

  • Problem with your src attribute
  • No images in the relative file path from the HTML document
  • Looking for jpeg images when your images are png files

2 Answers

Jonathan is probably right, they look like the likely offenders. another one might be how you are referencing the files. if the files you are linking to are in the same folder as the page it will work if you call them directly like this

src="/picture.jpg"

but if the file is in another location you need to use the actual address on the drive

src="c:/folder/picture.jpg"

that one can catch you out at times. TBH when i am developing something i tend to create a working folder with all the images in that i want local to the page so all i have to do is call the folder and image.

like this

src="pictures/picture.jpg"

thanks guys i did put them inside the same folder and it worked

awesome :) glad you sorted it