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

Trying to set images as backgrounds for websites using CSS!

My question is how to import the images from my computer and I would additionally like to know how to import from the web. And lastly the correct code to do so. I'm already familiar with the <img src=> tags. I've tried to use imgur to upload images but it doesn't seem to be working.

2 Answers

Hi Vishnu, i understand that images can be imported in this way:

body, .btn, #idDiv { background-image:url('image.jpg'); }

in this case image.jpg makes reference to your project folder if you want to point to a website, you just have to remplaze it with the 'http://mywebsite.com/myimg.jpg'

I hope you can use it! best regards. Le贸n

Thx Leon!