Results 1 to 2 of 2

Thread: Can't chnage background from color to Image

  1. #1
    Join Date
    Jan 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy Can't chnage background from color to Image

    Can someone please tell me how to change my CSS to use image for background instead of color? Have tried all I can to no avail. See the red and emboldened part in the code below:

    Code:
    body {
    	background:#151515;
    	background-image: url(../../images/background_images/abstract_background1.jpg);
    	background-repeat: no-repeat;
    	background-position: center top;
    }
    Last edited by jscheuer1; 08-10-2012 at 02:10 AM. Reason: Format

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,475
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Assuming that's the correct path to the image and it's there, that should be fine. It won't replace the color. It will show over it and be top center no repeat.

    It would be better to use background-color:

    Code:
    body {
     background-color: #151515;
     background-image: url(../../images/background_images/abstract_background1.jpg);
     background-repeat: no-repeat;
     background-position: center top;
    }
    Or the shorthand combined notation:

    Code:
    body {
     background: #151515 url(../../images/background_images/abstract_background1.jpg) no-repeat center top;
    }
    If you want a different color you can specify it. You can leave the color out or specify transparent, but for the body that would end up being white in most cases.

    If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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