Skip to content

Instantly share code, notes, and snippets.

@hansspiess
Created August 10, 2012 19:53
Show Gist options
  • Save hansspiess/3317337 to your computer and use it in GitHub Desktop.
Save hansspiess/3317337 to your computer and use it in GitHub Desktop.
Frontend: Replace Text with image, No-Images-Fallback
h1 {
background: url(image.gif);
height: 25px;
text-indent: -999em;
width: 250px;
overflow: hidden;
}
<h1 id="muster" title="Muster">Muster</h1>
function checkImages() {
if (document.getElementById) {
var x = document.getElementById('image').offsetWidth;
if (x != '250') {
document.getElementById('image').style.textIndent = '0';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment