How to change this css to rotate images?

Discussion in 'HTML & Website Design' started by JasMate, Aug 24, 2007.

  1. #1
    I have this code in my css file:
    
    #sidebar {
    float: left;
    width: 198px;
    height: 400px;
    margin-top: 72px;
    margin-left: 4px;
    padding: 5px;
    background-color: #090B06;
    background-image: url(pics/1.jpg);
    background-repeat:no-repeat;
    border: 3px outset #6F6740;
    }
    Code (markup):
    But instead of just showing 1.jpg I want to display a few different images at random from a directory, can I get a quick change to this code or a suggestion for how to do this, much appreciated :)
     
    JasMate, Aug 24, 2007 IP
  2. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Well it took me just under an hour of digging and I finally got something to work. For anyone wanting to do this check this out: http://sonspring.com/journal/easy-random-css-backgrounds and where you have "background-image: url(pics/1.jpg);" or similar change it to this: "background-image: url(rotator.php);"

    Edit, see my full working "african version" (home page image)

    :) Regards, Jas.
     
    JasMate, Aug 24, 2007 IP
  3. blurredfringe

    blurredfringe Member

    Messages:
    77
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #3
    thanks man, nice one.. :)
     
    blurredfringe, Aug 25, 2007 IP
  4. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Glad I could help someone else. ;)
     
    JasMate, Aug 25, 2007 IP
  5. qastex

    qastex Peon

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks......
     
    qastex, Oct 14, 2009 IP
  6. qiren83

    qiren83 Peon

    Messages:
    75
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    #sidebar {
    float: left;
    width: 198px;
    height: 400px;
    margin-top: 72px;
    margin-left: 4px;
    padding: 5px;
    background-color: #090B06;
    background-image: url(http:// gotoww.com/templets/images/feed.gif);
    background-repeat:no-repeat;
    border: 3px outset #6F6740;
    }

    u can use it in this way
     
    qiren83, Oct 14, 2009 IP
  7. Gungz

    Gungz Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Nice post.
    It gives me something new to learn..
     
    Gungz, Oct 14, 2009 IP
  8. leishusheng

    leishusheng Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    #sidebar {
    float: left;
    width: 198px;
    height: 400px;
    margin-top: 72px;
    margin-left: 4px;
    padding: 5px;
    background-color: #090B06;
    background-image: url(http://www.healthyfoodsicaneat.com/templets/images/feed.gif);
    background-repeat:no-repeat;
    border: 3px outset #6F6740;
    }

    u can also use it in this way
     
    leishusheng, Dec 30, 2009 IP