Home
Manage Your Code
Snippet: CSS Image Replace (CSS)
Title: CSS Image Replace Language: CSS
Description: Using CSS, replace a div area with an image Views: 579
Author: John Yan Date Added: 5/24/2008
Copy Code  
#ID_OF_ELEMENT {
    padding: HEIGHT_OF_IMAGEpx 0 0 0;
    overflow: hidden;
    background-image: url("hello_world.gif");
    background-repeat: no-repeat;
    
    height: 0px !important;
    height /**/:HEIGHT_OF_IMAGEpx;
}
Usage

Hello world!

let's say the height of the image is 35, the code will be #replaceMe { padding: 35px 0 0 0; overflow: hidden; background-image: url("hello_world.gif"); background-repeat: no-repeat; height: 0px !important; height /**/:35px; }