Load image from CSS

Discussion in 'CSS' started by immortality, Feb 20, 2007.

  1. #1
    If there a way to make it so I can put the image URL in a css stylesheet and it will display on my homepage as if I were using an <img src=""> tag?
     
    immortality, Feb 20, 2007 IP
  2. siu00as

    siu00as Peon

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do this by setting the background-image of an element.

    
    #test {
        background-image:url(http://www.examplesite.co.uk/image.jpg);
        height:100px;
        width:100px;
    }
    
    
    <div id="test"></div>
    
    Code (markup):
     
    siu00as, Feb 20, 2007 IP
  3. immortality

    immortality Peon

    Messages:
    1,512
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Worked perfectly, thanks.
     
    immortality, Feb 20, 2007 IP