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

John Marshall
John Marshall
3,475 Points

Fixed Banner

http://www.bucketlistly.com/

This site has an awesome header banner. The image stays fixed with text centered over it.

Anyone have any idea how to create this effect?

2 Answers

Steven Parker
Steven Parker
229,644 Points

I didn't see anything fixed, everything scrolled together. If you're just talking about having text over an image, that's the normal behavior when you use an image as a background.

But if you wanted to achieve an effect where an image doesn't move, it could be done in at least two different ways, depending on whether the image in question was part of the background or not.

For the background, the CSS property background-attachment can be used to hold the background still while the other parts of the page scroll.

For a foreground image, the CSS property position can be used to place the image at a particular screen location and make it unaffected by scrolling.

All of these concepts are covered in several of the CSS courses and workshops available here.