Text-replacement with @font-face and base64
Stylable, scalable, light and effortless text-replacement snippet : my own logo is a single character font compressed then encoded in base64, loaded via @font-face and customized via css.
Not a single http request - except the css, of course !
Bonus : using a data-attribute helps a lot with accessibility.
@font-face {
font-family: 'logo';
src: url('font/logo.eot');
src: local('?'), url(data:font/woff;charset=utf-8;base64,...;
font-weight: normal;
font-style: normal;
}
h1 a {
font: 0/0 a;
text-decoration: none;
}
h1 a:before {
content: attr(data-icon);
font: 200px/250px 'logo';
text-decoration: none;
}
Written by Gaël Poupard
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#