CSS Put image at top of page

Posted by happyCoding25 on Stack Overflow See other posts from Stack Overflow or by happyCoding25
Published on 2010-05-20T23:34:47Z Indexed on 2010/05/20 23:40 UTC
Read the original article Hit count: 289

Hi,

I need to have an image at the top-center of a web page in css. Now, Im just using the background-image: in css but this puts it at the middle of the page.

Here's my code:

body {
  background-image: url("theimageurlgoeshere"); //The image is 842 x 508
  background-attachment:fixed;
  background-position: center top;
  background-repeat: no-repeat;
}

Also, Changing the background-position: seems to have no effect on the outcome of the site. Any help is appreciated.

© Stack Overflow or respective owner

Related posts about css

Related posts about background-position