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

maayan malka
maayan malka
2,454 Points

slick one-pagers: how to place images in the back

hi all!

how do you build a website that has a main image on the back that can scale to all screens, and has the text in front. here are some examples:

http://crated.com/landing http://mylakemap.lt/?lang=en

Thanks!

Try to use the image as a background, you will be able to add content above that image. Hope this work for you.

3 Answers

John Steer-Fowler
PLUS
John Steer-Fowler
Courses Plus Student 11,734 Points

Hi maayan malka,

Like Chandan rightly said, you can set this as a background image using css. You can also use css to set the image to 100% width so that it is responsive depending on the screen size.

maayan malka
maayan malka
2,454 Points

tried image in background in the CSS: background-image:url(..); but it get's fixed to the background when I scroll down the page..

John Steer-Fowler
John Steer-Fowler
Courses Plus Student 11,734 Points

You can set a background image for a specific div and not just for the whole page. Then you can size the div to how you want.

Remember to set it to no-repeat so that it does not repeat the background image

background-repeat: no-repeat;
maayan malka
maayan malka
2,454 Points

ok got it! thanks!

John Steer-Fowler
John Steer-Fowler
Courses Plus Student 11,734 Points

Your welcome. Try it out, and remember if any answers help you, to upvote them and select a best answer when your question is solved.

Keep up the good work