How would I use a image size of 1008x576 as the background centered with black background color. Please could anyone help me with the CSS code for this.

2 answers

body {
    background: #000 (/images/your_image.png) 50% 0 no-repeat;
Answered over 7 years ago by Dwayne Anderson
  • And if you want it centered vertically as well... body { background: #000 (/images/your_image.png) 50% 50% no-repeat; } Doug over 7 years ago

You could also use the center keyword for centering in any axis. I''ve always found that a little more safe as some IE-version can misinterpret a percentage value if something else than 0%, 50% or 100% (

Answered over 7 years ago by Jens Hedqvist