Home   Web Top   Bottom Contents   Prev   Next

Should You Use CSS?

Topics on This Page

Some Browser Statistics
Should You Use CSS?
Where Should You Go From Here?


Some Browser Statistics

Before I answer the question "should you use CSS?," I'm going to toss out a few browser statistics.

A lot of different sites provide statistics on how many of each type of browser is in use. There is a lot of variation among the statistics shown by these sites. That's because each is showing statistics for the people who visit that site. The important statistic for you will be the browsers used by the people who visit your site.

I'm going to make up some numbers. They're reasonable, but they're certainly not totally accurate.

  • In the United States, figure that about 85-90% of the people are using IE 4 or newer. Most of these are using IE 5 or newer.

  • Netscape 4 accounts for about 5-10%. Netscape 6 has not yet caught on, and you won't see many Netscape 6 visitors for awhile yet. Some of the Netscape users are using Unix/Linux, and IE is not available. Others simply prefer Netscape to IE.

  • This leaves about 5% using other browsers. Around half are using older versions of Netscape and IE, and the others are using things like Opera, WebTv, and various other browsers.

  • Some of the people still using version 2 and 3 Netscape and IE browsers are doing so because their computers are older ones that cannot run the newer browsers. This includes many people who only have access to computers at public sites such as libraries and schools — these often don't have the funding available to upgrade to newer machines. If your target audience includes a lot of people who will be using public computers, expect to see a larger percentage of older browsers.

  • If you're targeting visitors from outside the United States, you can expect a much higher percentage of visitors with older browsers. The percentage will vary by country, of course.



Should You Use CSS?

When you make a decision whether to use CSS or whether to use deprecated tags and attributes for your formatting, think about the visitors you want to attract. If you expect that a number of them will be using older browsers, you'll make different decisions than if you expect most to be using current browsers.

Before you begin coding a web site, you'll want to decide whether or not to use CSS. If you decide to use CSS, you'll want to decide what things you want to use it for.

Here are some of your choices:

  • No CSS.
    • Your pages will look good in older browsers.
    • You'll have to use the <font> tag.

  • Use CSS in place of <font> but deprecated tags and attributes for other formatting.
    • Your pages will look fairly good in older browsers.
    • CSS is much easier to use than <font>, and provides a lot more flexibility.

  • Use CSS for all formatting (strict HTML).
    • Your pages will look very plain in older browsers.
    • Browser support is much poorer for many of the CSS capabilities.

No CSS

If you're expecting visitors who are using version 3 or older browsers, and if you want these visitors to see nicely formatted pages with fonts, colors and sizes that you choose, you must stick with the deprecated tags and attributes, including <font>, and you won't be able to use CSS.

CSS in place of <font>

If you're expecting visitors who are using version 3 or older browsers, but you're willing for those visitors to see usable but less nicely formatted pages, use CSS in place of the <font> tag for your fonts, colors and sizes. You'll have a much easier time of it, because it's far easier to use CSS than to use the <font> tag — especially if you use the <font> tag correctly.

If you want the page laid out as closely as possible to what your visitors with newer browsers will see, use the deprecated attributes rather than the CSS alternatives for other formatting. For example, if you want text to flow around a floating image, use align="left" in the <img> tag rather than the float: left; CSS property. This is the approach I'm using for most of my work these days. As an example, here is the previous page without the CSS formatting (this link opens in a new window). This is roughly the way the page would appear in Netscape 3 and other non-CSS browsers. It's not as pretty since the default font and color are used throughout, but I've retained some splashes of color by using deprecated attributes to color the table backgrounds. Even though the page doesn't look quite as nice, it's fully functional and readable in non-CSS browsers.

To illustrate how much easier it is to code using CSS than with the <font> tag, here is the CSS code for these pages. All of these pages use the same CSS code. If I were to decide to make all of the headings on all of these pages green rather than red, I'd only have to make one tiny change in the CSS code and wouldn't have to touch the individual pages at all. As I develop additional pages, I don't have to think about the formatting at all: I've already make my choices. And because all pages use the same CSS code, the pages have a very consistent look.

Strict HTML

If you're less concerned with how the page displays in non-CSS browsers, you can use more CSS and fewer deprecated attributes. You might not really care whether the text flows around that image in a non-CSS browser: it will still be readable.

The extreme case is to switch to strict HTML/XHTML and forego the deprecated tags and attributes entirely. It's quite possible to do this and still have functional and readable page in non-CSS browsers. More problematic are the older CSS-aware browsers: Netscape 4 and, even worse, IE 3. When you use CSS, it's quite possible that your pages will become difficult or even impossible to read in these browsers. If you want to support them, you must test your pages with them.


Where Should You Go From Here?

The remainder of this section deals with CSS. It's not essential that you learn the various CSS properties at this stage. If you'd prefer to learn some more HTML tags now, you can go back to the contents on proceed to the next HTML topic. You can return to this CSS section any time.

On the other hand, you might want to learn enough to be able to specify font faces and sizes at this point. I'll present those first (after a bit more introductory material).

If you decide you're going to use CSS, you'll certainly want to learn about borders and margins and things like that. You can either proceed on to those topics now, or come back after you learn more of the HTML tags.


Home   Web Top   Bottom Contents   Prev   Next