Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


backgrounds and objects

say i made a div for a mini "background" and i have pixels set to size and its all nice and colored. is there by any chance a way that i could put things like pictures, objects, or text on it? answer would be much obliged.

1 Answer

Hi dylan kane,

I'm not sure which answer you are looking for, so here's some options for you to do:

  1. If you would like to assign a background image to the div itself your css would look like this: div{ background-image: url(some-background-image.jpg); background-size: 100%; }

This will set your image as a background, and make it fit to the box, so you can see the whole image. More info at (http://coding.smashingmagazine.com/2009/09/02/backgrounds-in-css-everything-you-need-to-know/)

  1. If you want's to put other images og text on top, you will have to add it inside the div in your html :)

I hope it helps you to get further.