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

HTML

Responsive background image that moves up as height of browser decreases

Hi Everyone,

I have a background image on a site I am building. How do I make the background image move up as the height of the browser gets smaller?

Joseph Hall

1 Answer

Steven Parker
Steven Parker
243,656 Points

:point_right: Would background-position: center; do?

(or background-position: left center; ?)

Or how about positioning it using viewport-relative units, perhaps with the calc() function, depending on how much you want it to move?