Friday, December 28, 2007

Why You Need to Use Cascading Style Sheets on Your Web Site, Part I

Many people take our Dreamweaver class expecting to learn how to use Dreamweaver to create or edit a website. What they often don't realize is that they also need to learn Cascading Style Sheets (CSS) , too. Fortunately we provide significant information about CSS in our Dreamweaver class in addition to a new class just on CSS that we'll be offering in early 2008.

Why do you need to use CSS when creating a website? Well, one very basic reason, without CSS you would be using the html font tag to format text, what's wrong with that? The font tag is officially "deprecated" by the w3c, the World Wide Web consortium that controls and mandates standards for the web,. (http://www.w3.org/). "Deprecated" means it's on its way out, that some time in the future a browser is going to come out that does not support the font tag. In other words if you create a website today that uses the font tag to format text (choosing a typeface, a color, a size, etc.) it should be fine...for now, but what happens when a new browser appears that doesn't support it? All the text on your site will appear using default attributes not they way you intended it to look.

So using CSS now is recommended to avoid that problem, but that begs the question "Why is the font tag deprecated?" Or, put another way..."Why the big push to use CSS?"

In short, two reasons: one, CSS makes updating and maintaining your site a whole lot easier than using the font tag. Imagine if you need to change the color or typeface of the all the paragraphs in your site, using the font tag you'd have to go to every instance of it and change it, not just on one page but on every page of your site. On any medium to large site, this would be a long and tedious job.

With CSS, chances are that you'll make one quick change to change the color, typeface and size of all your paragraphs throughout your entire site.

The second reason to use CSS is that it there are loads of typographic controls that you have when using CSS that you just don't have when using html. For instance, line spacing (or "leading" as it's called by typographers), it's just not an option in html, but it is in CSS.

Also, CSS allows you to separate the content of your web site from the formatting/presentation of your site, which allows for the same content (the text, graphics,etc) to be layed out completely differently just be switching CSS files. This is a bit more advanced than just using CSS for formatting text, as we've mentioned previously, and I will discuss this issue further in an upcoming post.

For now, just remember using CSS for formatting text on your web site is THE way to go for ease of use, saving time and adding typographic control unavailable in html, but for those with a sentimental streak or html antiquarians remember there is still the forlorn, deprecated font tag still out there and still supported by all major browsers...for now.