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 CSS Basics (2014) Basic Layout Backgrounds: Size and Position

mike cee
mike cee
7,302 Points

image not scaling correctly

does the size of the jpg has to be really big in order for it to cover my header. i've replaced mountain.jpg with a pic from my cell just for fun but it does not work. thank you

Juan Perez
Juan Perez
Courses Plus Student 8,944 Points

Would you mind posting you code here so we can have a look at it?

1 Answer

Christian Lawrence
Christian Lawrence
3,941 Points

The image can be any size, using img{width: 100%;} or if your image is set with CSS as a background-image try using header{background-size: cover}.

However, if your image isn't the same dimensions as your screen it will stretch and look blurry. Consider how big some screens might be and how you could work around that.