| Home Web | Top Bottom | Contents Prev Next |
Some Browser Statistics
Should You Use CSS?
Where Should You Go From Here?
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.
|
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:
|
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.
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.
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.
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 |