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 full image background

i want to create a full image background web with the header etc. but i only found tricks for that, does anyone now which course is the correct?

I believe it is in the CSS Basics course. you can set your image and set the background-size: cover; declaration. It should make the image fill the container while preserving the aspect ratio.

2 Answers

There are two tecniques to scale the image in a container

.container {
    width: 100%;
    /*you can allow the height to be defined by the content*/
}

.img {
    width:100;
     /* Also you can define the height as needed */
}

.container{
    /* second way of doing it */
    background-image:url('smiley.gif');
    background-repeat:no-repeat;
    background-size:cover;
}

Here is one way to do it. CSS Full Screen Background