Results 1 to 2 of 2

Thread: Centering background image?

  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Centering background image?

    In dreamweaver I'm trying to figure out how I can have this starfield background remain in the absolute center of the page. Currently it stays always on the left side as the window is resized. I want the background image to stay in the middle always as the window is resized. Can anyone please tell me how this is done? Many thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    Add background-position: top center;

    body {
    background-image: url(../CJE%203/bg.jpg);
    background-repeat: no-repeat;
    background-color: #000000;
    background-position: top center;
    }

    or center center; if you want it centralised vertically as well, but top center seems to work OK.
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. Image Centering Problem
    By acidvisor in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 16 Jan 2007, 03:18 AM
  2. Using opaque image as background
    By sumacbob in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 20 Apr 2006, 09:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •