user1024430
user1024430

Reputation: 85

Sliding background

I am new to CSS, I am trying to make a background and main content remain centered as you shrink the browser like this site http://www.webdesignerdepot.com/ If you widen the browser over two screens, the background remains central and the same size and the margins increase to fill the space, but when you shrink it, the background remains centered to (what I assume is) a minimum size before it fixes left, in other words both sides of the background image are pushed out of view up to a point. Hope that makes sense?

Upvotes: 1

Views: 351

Answers (1)

Polynomial
Polynomial

Reputation: 28316

They're using background-position:center; to place the background in the middle of the screen. When the browser window is smaller than the background image, it is clipped. When the browser window grows larger than the image, it stays in the center. The image edges fade into the background colour of the body, so that it gives the impression of being part of the background.

Upvotes: 1

Related Questions