Skip to content

Instantly share code, notes, and snippets.

@mdemrs
Last active August 29, 2015 14:14
Show Gist options
  • Save mdemrs/882faee405bd2bb2fd03 to your computer and use it in GitHub Desktop.
Save mdemrs/882faee405bd2bb2fd03 to your computer and use it in GitHub Desktop.
css: Image replacement
.ir{
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@mdemrs
Copy link
Author

mdemrs commented Jan 28, 2015

font:0/0 a – a shorthand property that zeros out the font size and line-height. The a value acts as a very short font-family (an idea taken from the BEM implementation of this method). The CSS validator complains that using 0/0 in the shorthand font property is not valid, but every browser accepts it and this appears to be an error in the validator. Using font:0px/0 a passes validation but it displayed as font:0/0 a in the code that the validator flags as valid.
http://nicolasgallagher.com/another-css-image-replacement-technique/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment