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

Tamta Meskhishvili
Tamta Meskhishvili
5,026 Points

background image isn't fully visible

Hi all. I'm trying to add background-image to website but it isn't fully visible, background image appears too large and some parts of the image are cut off.

It should look like this http://www.mediafire.com/view/we4u2ftitb5n0kh/111.png

but looks like this, here is the screenshot http://www.mediafire.com/view/dcdvdr1mcq0anc6/screenshot.png

this is my code

body{
    background: url("img/111.png") no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

1 Answer

RaΓΊl Barrera C.
RaΓΊl Barrera C.
18,943 Points

That's because the height of body alter the aspect ratio of image and this cut. Try to set a height to maintain image aspect ratio ;)