Replace HTML text with image using only CSS

/ Published in: CSS
Save to your folder(s)

This is handy for cleaning up your HTML to use more plain text and fewer img tags. Whether this is SEO friendly or not is subjective. I tend to think it's fine as long as you don't use it for spam. Digg implements a similar method for their main logo.

Copy this code and paste it in your HTML
  1. #myLogo {
  2. display:block;
  3. width:135px; /* change to your image width */
  4. height:35px; /* change to your image height */
  5. background:url(myLogo.gif) no-repeat;
  6. text-indent:-9999px;
  7. }
  10. /* in your HTML:
  12. <h1 id="myLogo">My Company Name</h1>
  14. */

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.