Created
June 8, 2013 20:27
-
-
Save jeroentbt/5736456 to your computer and use it in GitHub Desktop.
CSS Image replacement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$imageWidth: 100px; | |
$imageHeight: 30px; | |
.replace { | |
display: block; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
background: url(http://notrealdomain2.com/newbanner.png) no-repeat; | |
width: $imageWidth; | |
height: $imageHeight; | |
padding-left: $imageWidth; | |
} | |
// It works on just about any element, even empty ones like <img> or <hr> | |
// Browser support is excellent (Chrome, Firefox, Opera, Safari, IE8+) http://caniuse.com/#feat=css3-boxsizing | |
// Refrains from using SEO unfriendly display: none or other properties | |
// source: http://css-tricks.com/replace-the-image-in-an-img-with-css/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment