1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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