3 Ways to Make Your Site Look Better in More Browsers by Mark

When it comes down to it, working towards getting your latest website or project to look its best across all major Web browsers can be a chore. Luckily, as developers, we all have our ways—and that's just fine. What most people overlook are the opportunities for adding a little more finesse across those browsers.

Here are three tips for Web designers and developers to ensure that your designs are looking sharp as can be, aided by only adding a little extra flair (and code).

Add CSS Text Shadows for Cleaner Text

It's no secret: applying text shadows on the Web has never been easier. Well, at least if you're using Safari, Opera 9.5, or Firefox 3.1a. By adding just a single piece of code to your stylesheet, you can get crisper text. Here's the CSS you'll need:

  1. body {
  2. text-shadow: 0 0 0 #000;
  3. }

The secret is in the way browsers handle the text-shadow. Newer browsers render an anti-aliased effect over your text, causing it to look just as good—maybe even better—as it can in Photoshop.

The text-shadow CSS fix in action shows the before (left) and after (right) in Safari 3.x when applying the single piece of CSS. See the improved rendering?

But what about users of older browsers? For some, there is hope. With Firefox 2, there is a small CSS hack that allows the fonts to be rendered in relatively the same manor. Here's the CSS:

  1. body {
  2. opacity: : .99;
  3. }

Coupled with the text-shadow filter, which doesn't affect Firefox 2, you're now set for all browsers save Internet Explorer. That means Firefox 2, Firefox 3, Safari, and Opera are all getting more accurately rendered text. Watch out though, this hack has a few nuances that may sidestep your development.

Better Image Scaling in Internet Explorer

Image scaling via CSS and inline HTML is no big deal, but it has never worked well in Internet Explorer—go figure, right? Well, the creative minds behind Flickr have found two ways to help out IE6 and IE7 improve image scaling.

It turns out that the same method of scaling images—something called bicubic resampling—is present in all modern browsers, but it's disabled in IE7. See the difference?

Before and after using enabling the resampling. (Image credit Joel Spolsky)

You can enable it in IE7 with a bit of CSS:

  1. img {
  2. -ms-interpolation-mode: bicubic;
  3. }

The only problem here is that it doesn't work for IE6. For that, we need to use an AlphaImageLoader CSS filter, just like most people use for any PNG fix. Here's the code you'll need to add:

  1. filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src='/path/to/image.jpg', sizingMethod='scale');

It's not the best results, but it certainly does give a better picture (pun intended) for your audiences.

Bring Up the Rear: Turn IE5/6 into IE7

Read more about Dean Edward's Javascript project, IE7.

What's that mean exactly? It means that, with a little Javascript, you can render CSS in IE5 (on Windows) and IE6 just like IE7. Thanks to Javascript guru Dean Edwards, we now have a script that makes our least favorite browsers render CSS more accurately. As a bonus, it also makes transparent PNGs work!

With this fix, aside from some extra Javascript, there's no real disadvantage. You'll save development time by not having to address the box model issues, by using more pseudo selectors, and more—all without having to overhaul your website's structure. With Javascript market saturation likely above at least 95%, you don't have much to lose (save a little time learning the ropes).


Developing solid interactive experiences cross-browser has always been an issue. As long as browsers continue to interpret HTML and CSS in different ways, we'll have these issues to deal with. With browsers no longer under development, like IE5 and IE6, we can take some of the problems out of the picture.

These issues might seem superficial, but it's the details that make for grand experiences online. Take the extra time to use these simple cross-browser techniques to make your website look and behave it's best. Enjoy!

5 Comments

  • Bruno Bergher says:

    Really great article, Mark. Thanks a lot. The text-shadow and 99% opacity tips come from that place where almost imperceptible subtleties make a lot of difference in the overall result. Perhaps we'll have kerning in CSS, at some point... Cheers!

  • Farrhad A says:

    Some great tips! Have bookmarked it for future reference.

  • Randa Clay says:

    Holy cow, that script looks awesome! Have you tried it? Could save a lot of hours fighting with IE6, and the fact that it causes PNG transparency to work as well is really great.

  • Mark says:

    We've used the script on small in house tests, but not in real world applications. It really is a sweet setup, one we're going to work into our next project :).

    Glad you guys enjoy it!

  • hi will says:

    Thanks for the work arounds! I'm hopeful you may have another up your sleeve.

    So, I've got an image (it's a photo of a newspaper section front) which is being resized from 200px x 316px to 120px x 190px. In IE7, using the interpolation mode, I'm able to get a very nice representation of the resized image. However, in FireFox 2, it looks horribly pixillated and, frankly, like it would look in IE7 without the interpolation.

    Any idea how I can get the image to look better in FF2? I tried the opacity hack with no success.

Add your comment...

Required

Required, but not shared. Nerd's honor.

About the ZURBlog

The ZURBlog is where we discuss design interaction and strategy. We use design thinking to challenge businesses and designers to improve the products and services they create.

Recent Posts

What's the ZURBword?

What's the ZURBword?

ZURBword.com is our thoughts on interaction design and strategy. What?

Photos on Flickr

  • 4821798712_a59412e236_s
  • 4821797872_d7f1536a2a_s
  • 4774579941_9e8716910a_s
  • 4763601643_f0ce03a887_s
  • 4764235066_49f1ba7055_s
  • 4763591117_d8d093c510_s
  • 4764222474_373922c9fb_s
  • 4764217980_209b0bdd81_s
  • 4763572077_8789ecb9da_s

Videos on YouTube

Bookmarks on Delicious

Wanna talk? Call us at (408) 341-0600.

Hmm, not a big talker. Email us to .

Still here? Great, we're hiring.

We need people with chops to join our quest
for world domination. Want a job, nerd?

What's the ZURBword?

ZURBword.com is our thoughts on interaction design and strategy. What?

Subscribe to ZURBnews

Get our monthly newsletter, ZURBnews.
Check out the latest news and buzz »