Home
» Other Stuff » CSS align background image center
CSS align background image center
| April 20, 2009 | Posted by The Futtock under Other Stuff |
If you want to center and middle align a background image, use the following CSS code:
body {
background: #000 url(images/background.jpg) no-repeat center;
}
If you want a fixed image, center aligned but not middle aligned, try this:
body {
background-image: url(images/background.jpg);
background-repeat: no-repeat;
background-attachment:fixed;
background-position: 50% 0%;
}
Recent Comments