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

Image inside a box.

Please look at this pen: http://codepen.io/CrystalVisions/collab/zmLkK and see if you can tell what I am doing wrong and why line 21 seems to fix the problem?

3 Answers

Take off the WIDTH value from #deer then will fix it, setting the width with an fixed value it will not be inherit the parent element and ignore him width.

Sorry bad english, not my native.

What is it that you want? I'll try and help.

Good answer Gabriel. Also you might want to make an image tag instead of the background-image in a div. Then you can create alt-text etc. If the image doesn't load for some reason.

That is what I ended up doing but I did want to know why my first way did not work and Gabriel gave me that answer. Thank you all for responding to my question!