#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    UK, London
    Posts
    95
    Rep Power
    12

    CSS background center? HELP


    Hi, im a realy newbie in CSS...

    Can anyone tell me how i can center my background image horizontally, while keeping the background at the very top.

    I have tried the background-position: center command but that puts the background in the center of the page which is not what im trying to do...


    thanks for your help!
    seb
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    UK, London
    Posts
    95
    Rep Power
    12
    wow! hey i just found out by sheer luck myself! thanks anyway!
  4. #3
  5. Thanks Johnny Hart (BC) R.I.P.

    Join Date
    May 2003
    Location
    Dallas
    Posts
    5,268
    Rep Power
    1956
    Glad you cured your problem. It is, however, considered polite and helpful to post the cure for the benefit of others who might have a similar problem.

    cheers,

    gary
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    UK, London
    Posts
    95
    Rep Power
    12
    yeah sorry, i got caught up in the moment lol!

    Anyway this is how i did it:


    body {
    background-image: url('http://BLAH BLAH');
    background-repeat: no-repeat;
    font-family: "Courier New", Courier, mono;
    font-size: 11px
    }


    That was the code in my CSS file and the background was at the top left of the screen. So by simply adding this line to the code:

    background-position: center 70;

    you can see the it centralises the background horizontally on the page. Then the number 70 puts the backgroundimage 70 pixels down from the top.

    Really hope this helps someone!
    seb

IMN logo majestic logo threadwatch logo seochat tools logo