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

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.

Regards