How To Properly Smooth Font Using CSS3

How To Properly Smooth Font Using CSS3

I've came across some people usually wondering how some websites have such crisp and clear font. There are two reasons for this:

1. They are most likely using the -webkit-font-smoothing hack. This type of hack is mostly used for mobile browsers, as well as the Apple Safari and Google Chrome Browsers.

2. To really smooth the font and not have anything too blurry websites usually use the text-shadow effect. This is also used so the font will look smooth on all browsers (Opera, Firefox, Safari, Chrome and others alike) except internet explorer.

When you apply the font smoothing hack to your stylesheet and you want it applied to your whole site, make sure we write the following code.

Lets start off by adding the font smoothing hack to your stylesheet:
html, html a {
    -webkit-font-smoothing: antialiased !important;
}

Here is the definition of anti-aliased: http://en.wikipedia.org/wiki/Spatial_anti-aliasing

Now for the text shadow effect to really smooth out the font:
html, html a {
    text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
}
Here is the code all put together:
html, html a {
    -webkit-font-smoothing: antialiased;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
}

To really see what I am talking about, here are a couple of demo's that shows it's smoothing.

If you have a good eye for this kind of design, you will notice the difference:

Here is how it looks when the font is not smoothed:

Hello World!

Here is how it looks when the font is smoothed:

Hello World!

30 Jun 2011 13:06

rating: +2+x

Add a New Comment
developer-icon-set.png

About Us

Here at the Icon Deposit, we give you the opportunity to post your icons, designs, codes, and screenshots to promote your work and gain new clients. We feature hundreds of free icons, icon sets, UI/UX design, illustrator graphics, vector art, code tutorials for CSS, CSS3, JQuery, photoshop tutorials and tons more. If you would like a custom design or website built, Contact Us.

Popular Posts

Copyright © 2011-2019 Icon Deposit - All rights Reserved