Nooby CSS question

Discussion in 'CSS' started by MikeB67, Jul 2, 2008.

  1. #1
    I have a plain colored background on one of my sites and I was wondering how can I change it to a small image (1px by 1px - to repeat itself) that looks like a nice texture. The current css for the section I want is.

    #wrapper {
    width: 800px;
    margin-left: auto;
    margin-right: auto;
    background-color: #404864;
    }

    So how would I do this?
     
    MikeB67, Jul 2, 2008 IP
  2. nfd2005

    nfd2005 Well-Known Member

    Messages:
    295
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    130
    #2
    #wrapper {
    width: 800px;
    margin-left: auto;
    margin-right: auto;
    background:url(myimage.gif) #404864;
    }

    This will allow the background to repeat throughout #wrapper. If the image doesn't exist or isn't loaded, the background color of #404864 will take its place.
     
    nfd2005, Jul 2, 2008 IP
  3. MakeThatDollar

    MakeThatDollar Notable Member

    Messages:
    4,451
    Likes Received:
    158
    Best Answers:
    0
    Trophy Points:
    225
    #3
    #wrapper {
    width: 800px;
    margin-left: auto;
    margin-right: auto;
    background: url(images/imagename.gif) repeat;
    }
     
    MakeThatDollar, Jul 2, 2008 IP
  4. MikeB67

    MikeB67 Member

    Messages:
    575
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    35
    #4
    thank you very much
     
    MikeB67, Jul 2, 2008 IP
  5. Rubenator

    Rubenator Peon

    Messages:
    40
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Shorthand:

    #wrapper {
    width: 800px;
    margin: 0 auto;
    background: url(images/your_image.gif);
    }

    By default, the background image will be repeated so, a "repeat" value after image's url will not affect the ending result.
     
    Rubenator, Jul 2, 2008 IP