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
liolo liol
Courses Plus Student 59 Pointscss 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?
2 Answers
John Moya
17,963 PointsThere 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;
}
Chyno Deluxe
16,936 PointsHere is one way to do it. CSS Full Screen Background
Russel Klueg
2,813 PointsRussel Klueg
2,813 PointsI 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.