Make a background image stretch or adjust with CSS (Works w/ WordPress)

Stretching a background image with CSS

WordPress BG Stretch

     This simple snippet of CSS will stretch or shrink a background image based on the resolution of the browser.

Add the following CSS to your stylesheet(for WordPress add this under your themes stylesheet):

body {
     background: url(images/bg.jpg) no-repeat center center fixed;
     -webkit-background-size: cover;
     -moz-background-size: cover;
     -o-background-size: cover;
     background-size: cover;
}

Comments are closed.