CSS and Typography
Barcamp Albuquerque was just a short month ago. I had a great time and enjoyed meeting everyone there. One fascinating thing about Barcamp is that the requirement to present brings out some fun stuff in people. The topics people choose to present come from one of two sources: Either a) It’s what they’re absolutely most passionate about, and thus at least an ad-hoc expert. Or b) It’s whatever issue they recently struggled with, figured out, and need to share with other people to save them the time. I suppose my topic was a bit of both.
I presented on CSS and Typography. My background is in print, and one of my passions as a print designer is typography. I love seeing well-set type printed on a page, I love that at the end of every Harry Potter book they mention it was printed in Garamond. Moving to web was a struggle for me in the type arena. Discovering CSS was wonderful, but immediately the limitations of the web presented themselves and frustrated me.
Once I discovered Flash I was giddy. Just the idea of being able to embed fonts in a site got me rushing off to tell my friends about it. Naturally, as many web designers did, I discovered some of the limitations of publishing websites with flash and I ran back to CSS and tried my best to make websites with the limited web-safe fonts, and felt a little bit of my typographic soul die.
Not all is lost though; in my presentation at Barcamp I talked about two techniques you can use to incorporate some custom typography, at least in headlines, on your website.
Image Replacement
The first is image replacement. I’ve heard a few people refer to this idea as “dead” or at least “a bad idea”. However, I submit that, if used judiciously, image replacement can do feats no other technique can manage.
Let’s start with how how to use it. Here’s a perfectly obvious headline:
<h1>Method Arts Fall Badminton Spectacular</h1>
Instead of using text, we want to use something fabulously designed, so in the CSS, you give the text a negative indent, and then put in a background image behind the h1 element.
h1 {
margin:0;
text-indent:-32697px;
background: url(graphics/head.jpg) no-repeat 0 0 ;
width:508px;
height:173px;
}
Poof! The image is there, but the HTML remains having text in an h1 tag. (Why the odd number for text-indent? That’s Opera’s maximum value that it will understand for text-indent. Thanks to Steven in the comments for alerting me to the problem.)
I’m not dead yet
Why is this better than just using an image tag? I agree it does seem like using image replacement is a lot of work. There are a few reasons that this is worth it. For one, what Google sees when it comes to the site is some text in an H1 tag, rather than an alt tag. Google may or may not interpret that alt tag to be an important headline. Next, when you print that page, instead of printing a graphic that wastes ink and is blurry anyway because it’s at screen resolution, you print text. This requires a bit of extra work in that you need to use print style sheets, but it’s work you should be doing anyway.
Image replacement isn’t a silver bullet. The main limitation is that it only works for static headlines and areas. To jump that hurdle designers need to employ something more sophisticated.
sIFR
sIFR is a pretty clever little tool that uses flash and javascript to dynamically replace any text in the page with the font of your choice. I know, it sounds too good to be true, but it works. sIFR also accomplishes the daring feat of being both completely valid and accessible. Going through code examples here will be too tricky, so I’m going to link to my code from the presentation. You can also read up on sifr here.
sIFR, too, has its drawbacks. It’s trickier to implement, it’s more work and it uses javascript. Still, the payoff is that you get to use your custom fonts in dynamic headlines. That’s hard to beat.
Soup Up Your Toolbox
All in all these are great tools to have in your toolbox when making websites. We use both of them right here on the Method Arts website. One of the most fun uses of them is on the party invite that we did. Sure, it looks just like a bunch of images, but it’s actually replaced text. It seemed like a silly geeky thing to do, but it actually worked. Google indexed the page, and people were finding the invite based on search terms in the replaced text.
Neither tool is a silver bullet, but these days it doesn’t seem like one exists. Nonetheless these are essential tools to have in your toolbox for getting great typography on the web.
Downloads
Podcast of my presentation (with interview) (thanks to Reid Givens from ALR Marketing for podcasting the entire event).
PDF Presentation
Code Examples


Giles Bowkett - typed this brilliance on Dec 27, 2006
Brian Warren - added to the collective on Jan 1, 2007
It is better to stick with -9999px.
Good article by the way and I haven't checked up on sIFR for a while now.
Steven Hambleton - couldn’t keep them to themselves on on Jan 1, 2007
I always thought the -values is a bit messy.
/ Martin
Marteinn - felt the overwhelming need to share this with everyone on Mar 8, 2007
http://www.subdreamer.com/plugins/p13_download_manager/images/176.jpg
http://www.subdreamer.com/forum/showthread.php?t=9381
Someone recognized your site's awesomeness and is selling it
Johan Wilkes - shared this intimate secret on Mar 17, 2007
Justin Sepulveda - started this rumor on Apr 16, 2007
<H1><span></span>Some Text</H1>
h1 {
position: relative;
font-size: 2em;
height: 88px;
width: 155px;
overflow:hidden;
}
h1 span {
background-image: logo.gif;
height: 88px;
width: 155px;
position: absolute;
left: 0px;
top: 0px;
}
Give the heading a fixed size (ems of course) and then absolutely place the span over it and give the span a background image.
This way you achieve 3 things:
1. Screen Readers can Read it
2. You get your Image logo
3. People with images disabled can still read your logo.
- typed this brilliance on Apr 21, 2007
Victor - came up with this gem on Jul 1, 2007
"Hiding text or links in your content can cause your site to be perceived as untrustworthy since it presents information to search engines differently than to visitors."
Joshua McGinnis - used their words like weapons on Feb 22, 2008
Buisness Cards - typed this brilliance on Jul 12, 2008
מקרנים להשכררה - had this incredible stroke of brilliance on Jul 12, 2008
Lyrics and Guitar Chords of Besame Mucho - made this noise on Jul 12, 2008
Search Engine Optimization - Web Directory - shared this intimate secret on Jul 15, 2008
Algonquin Real Estate - started this rumor on Jul 17, 2008
Start a computer repair buisness - felt the overwhelming need to share this with everyone on Jul 24, 2008
Giftoverload.com - typed this brilliance on Jul 27, 2008
What you said is only half true. If you hide a large amount of keywords / links (say 100 keywords or so) in a single page then consider yourself infracted. Google knows about these practices and will ban anyone who do key stuffing.
However, if you're hiding just a few words (headings, titles, etc) to say, replace them for images, then you should be OK.
Web Development blog - typed this brilliance on Jul 30, 2008
margin:0;
text-indent:-32697px;
background: url(graphics/head.jpg) no-repeat 0 0 ;
width:508px;
height:173px;
}
Thanx! I find this css method.
Twistys - shared this intimate secret on Aug 2, 2008
Kombi Van Sales - couldn’t keep them to themselves on on Aug 2, 2008
crystal report - felt the overwhelming need to share this with everyone on Aug 4, 2008
<h1>' alt=</a>
rienarry - started this rumor on Aug 4, 2008
<div id="main">
<!-- this div must be 50% in width and should hang on left -->
<div id="left">
<div>
<!-- this div must be 50% in width and should hang on Right -->
<div id="right">
</div>
</div>
I have tried this but right div gos down the line where left Div is.
hope you guys defineatly have aProffesional solutions (without using CLEARFIX or any other stuff)
Thank you!
Dilantha.
- felt the overwhelming need to share this with everyone on Aug 5, 2008
CSS Tips and Techniques - used their words like weapons on Aug 5, 2008
Movie Trailer | Harry Potter and the Half-Blood Prince
- added to the collective on Aug 5, 2008
Pwhndvve - shared this intimate secret on Aug 9, 2008
Video Games Rental - shared this intimate secret on Aug 20, 2008
Modded Autos - couldn’t keep them to themselves on on Aug 20, 2008
Thank you.
bollywood - couldn’t keep them to themselves on on Aug 20, 2008
Sylvania HDTV - started this rumor on Aug 21, 2008
We create impeccable quality replica Rolex Daytona and Submariner and sell them at a price relative to what they cost us to make.
If you buy one of our imitation Rolex watches you’ll enjoy the quality of an original for just a couple hundred bucks.
The idea is to go beyond the standard Rolex knockoff and create luxury items at affordable prices.
http://sites.google.com/site/rolexchoose/
Thanks.
Rolexwatch - felt the overwhelming need to share this with everyone on Aug 23, 2008
Adam
Compare Prices with Order.com
Adam - shared this intimate secret on Sep 9, 2008
rafi
הסעות - felt the overwhelming need to share this with everyone on Sep 14, 2008
Compatible Ink Catridges - came up with this gem on Sep 16, 2008
Promotional Products - had this incredible stroke of brilliance on Sep 22, 2008
jobs in accounts - shared this intimate secret on Sep 27, 2008
Cheers,
Poison Ivy Treatments
Poison Ivy Treatment - had this incredible stroke of brilliance on Oct 1, 2008
Postage Printing - added to the collective on Oct 1, 2008
mini game - started this rumor on Oct 2, 2008
השכרת מקרנים - shared this intimate secret on Oct 3, 2008
השכרת מקרן - typed this brilliance on Oct 3, 2008
Personal Finance - had this incredible stroke of brilliance on Oct 3, 2008
essay - felt the overwhelming need to share this with everyone on Oct 8, 2008
HealthSolutions - couldn’t keep them to themselves on on Oct 11, 2008
Thanks for sharing mate.
John Craig - came up with this gem on Oct 12, 2008
Freelance Sales - made this noise on Oct 13, 2008
Promotional Companies - made this noise on Oct 15, 2008
Essay - made this noise on Oct 19, 2008
Top Ten Lists - shared this intimate secret on Oct 19, 2008
Matt Jason - typed this brilliance on Oct 27, 2008
Hehe. Yeah, I remember myself in the situation like that. Good old Flash days...
danny - couldn’t keep them to themselves on on Oct 30, 2008
Garage Services Norwich - made this noise on Nov 1, 2008
Suzanne - had this incredible stroke of brilliance on Nov 1, 2008
Essay - used their words like weapons on Nov 2, 2008
vilneap - shared this intimate secret on Nov 2, 2008
Swimming - couldn’t keep them to themselves on on Nov 2, 2008
Greets Wellnessferien
Wellnessferien - couldn’t keep them to themselves on on Nov 4, 2008
thanks
Investment dir - added to the collective on Nov 5, 2008
i have already started to work on that tools.
thank
Life insurance cover - came up with this gem on Nov 8, 2008
Documents Management - shared this intimate secret on Nov 9, 2008
Dog items - came up with this gem on Nov 9, 2008
Sign Clemente Homepage - started this rumor on Nov 11, 2008
thanks..
Travel Insurance Canada
Travel Insurance Canada - added to the collective on Nov 14, 2008
Documents Management - had this incredible stroke of brilliance on Nov 16, 2008
Sim only contracts
- added to the collective on Nov 17, 2008
I have included the span and then dislpay. dint notice the chagne
Mobile Phone blog - made this noise on Nov 18, 2008
http://sites.google.com/site/rolexchoose/
Thanks.
watchess - added to the collective on Nov 22, 2008
Cash Gifting Program - used their words like weapons on Nov 25, 2008
Foredragsholdere - used their words like weapons on Nov 25, 2008
Get Free Ads on Google - felt the overwhelming need to share this with everyone on Nov 26, 2008
thanks..
regards,
kkiln
web hosting - couldn’t keep them to themselves on on Nov 27, 2008
thanks a lot..
regards,
Reverse Phone Searches
Reverse Phone Searches - came up with this gem on Dec 1, 2008
Greets Holz
Holz Export - started this rumor on Dec 1, 2008
Italian Schools - had this incredible stroke of brilliance on Dec 1, 2008
elib - felt the overwhelming need to share this with everyone on Dec 1, 2008
Flood Damage - came up with this gem on Dec 2, 2008
Chesterfield Sofas - came up with this gem on Dec 6, 2008
Professional website design - started this rumor on Dec 8, 2008
Quotes by Bob Marley - felt the overwhelming need to share this with everyone on Dec 10, 2008
regards,
microwave cooking
microwave cooking - added to the collective on Dec 10, 2008
Migraine Headaches - shared this intimate secret on Dec 11, 2008
thanks..
<a href=" http://www.gotcheapwiifit.com">Wii Fit in Stock</a>
Wii Fit in Stock - couldn’t keep them to themselves on on Dec 11, 2008
sweet love quotes - felt the overwhelming need to share this with everyone on Dec 14, 2008
Thanks,
Peter
Bergsøe Møbel snedker - shared this intimate secret on Dec 16, 2008
Jillian - came up with this gem on Dec 17, 2008
Diamond Blade - came up with this gem on Dec 21, 2008
naruto logo - typed this brilliance on Dec 24, 2008
John Tech - felt the overwhelming need to share this with everyone on Dec 26, 2008
Greets Wellness
Wellness - added to the collective on Dec 29, 2008
Famous Bob Marley Quotes - used their words like weapons on Dec 30, 2008
you will post again like this.
Chesterfield Sofas - came up with this gem on Jan 3, 2009
regards from
Vandy
Online Play Sport Blog - used their words like weapons on Jan 3, 2009
zara clothing - used their words like weapons on Jan 5, 2009
designer clothing - had this incredible stroke of brilliance on Jan 5, 2009
Free Games - came up with this gem on Jan 6, 2009
Thank you.
Cayenne Pepper Diet
Lemon Cayenne Pepper Diet - made this noise on Jan 6, 2009
Thank you. Lastminute
Lastminute - made this noise on Jan 7, 2009
Wellness - shared this intimate secret on Jan 7, 2009
Funny Sayings Collection - typed this brilliance on Jan 9, 2009
thanks for great stuff..
regards,
Helboy
Organic Baby - typed this brilliance on Jan 16, 2009
Greets Holz
ขายบ้านเชียงใหม่
ขายบ้านเชียงใหม่ - came up with this gem on Jan 17, 2009
Rules of Engagement
Add a Comment