Tuesday, April 03, 2007

Using Background-Image to Replace Text css

Today i have read one artilce about using background image to replace text in css.. But they are using two elements for achieving this. You can find the article here
http://www.stopdesign.com/articles/replace_text/

However we have a better solution like this?

Suppose we have h1 element.

we will put the backgound image for h1 element in the style sheet
and text-indent -9999px in the style.

example:
#header h1 a {
background:transparent url(images/logo.gif) no-repeat scroll left center;
float:left;
height:85px;
text-indent:-9999px;
width:308px;
}

cant we do like this?

No comments: