How do I stop the background repeating?

Discussion in 'CSS' started by Peter Brown, May 2, 2007.

  1. #1
    Hi there,
    I currently have this:

    body {
    background-image: url(bkgd.gif);
    }

    But the background repeats on the page. How do I prevent it from doing so?

    Thanks in advance,
    Peter
     
    Peter Brown, May 2, 2007 IP
  2. sourcer

    sourcer Well-Known Member

    Messages:
    960
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    120
    #2
    sourcer, May 2, 2007 IP
    Peter Brown likes this.
  3. Peter Brown

    Peter Brown Well-Known Member

    Messages:
    1,638
    Likes Received:
    117
    Best Answers:
    0
    Trophy Points:
    180
    #3
    Thanks a lot sourcer! That sure was a quick reply.

    I tried it and it seems to only show on 1/4 of the page now at the right.

    you can see it here - www.ceneb.com :)
     
    Peter Brown, May 2, 2007 IP
  4. sourcer

    sourcer Well-Known Member

    Messages:
    960
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    120
    #4
    I see... for that to look good you should use background-repeat: repeat-x; instead of background-repeat: no-repeat;
     
    sourcer, May 2, 2007 IP
  5. Peter Brown

    Peter Brown Well-Known Member

    Messages:
    1,638
    Likes Received:
    117
    Best Answers:
    0
    Trophy Points:
    180
    #5
    Wow, thanks a lot sourcer! :D

    Rep added!
     
    Peter Brown, May 2, 2007 IP
  6. Katy

    Katy Moderator Staff

    Messages:
    3,490
    Likes Received:
    513
    Best Answers:
    7
    Trophy Points:
    355
    #6
    You can also use a shorter alternative:

    body {
    background: url(bkgd.gif) repeat-x;
    }

    Kate :)
     
    Katy, May 2, 2007 IP
  7. sourcer

    sourcer Well-Known Member

    Messages:
    960
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    120
    #7
    Thank you very much Peter :)

    @Katy: yes that works to :p I have showed Peter a link to a good CSS tutorial, he can learn many things from there ;)
     
    sourcer, May 2, 2007 IP