Saturday, September 20, 2008

Introduction to Cascading Style Sheets (CSS)

What is CSS?
What are cascading style sheets? Let’s suppose for a minute that you wanted all your paragraphs in a multi-page document to be center-aligned. If you omit the attribute and value for the

tag, what do you think the browser will do? It will simply use its default setting, which is left-aligned. So, every time you create a new paragraph, you have to remember to type in the attribute and the value. If you forget, your document won’t look like you want it to be.
Now that would be no big deal if you only had to deal with one or two pages and one or two tags, but what if you are dealing with a website that has 50 pages and hundreds of different tags.
CSS was introduced in late 1996, as an elegant cousin to HTML that promised several things, including:

• more precise control than ever before over layout, fonts, colors, backgrounds, and other typographical effects;
• a way to update the appearance and formatting of an unlimited number of pages by changing just one document;
• compatibility across browsers and platforms; and
• less code, smaller pages, and faster downloads.
CSS represents the Word Wide Web Consortium’s (W3C’s) effort to improve on the tag and attribute based style of formatting. The idea is that style sheets provide a way of customizing a whole page and even whole sites at one time and in much richer detail than the simple use of tags and attributes.
Plus, CSS is sort of like the cornerstone of Dynamic HTML, which is another subject that you should investigate. We aren’t going to get into that subject too much other than to show you how to add DHTML effects to your web using Front Page and possibly importing some already created DHTML applets into your web.
So CSS is a technology that gives you, as a webmaster, much more control over all these things that you would ever have in HTML alone. So let’s dig in to the basics.

It is worth the effort to learn and implement CSS’s because they provide unsurpassed control over the layout of Web pages. They're also the most efficient way to maintain and update a large site, and they make for smaller pages that download faster.
CSS works through individual style sheets rules that consist of selectors and declarations. These rules can be embedded in an HTML document, linked to or from an HTML document, imported to an HTML document, or added inline within an HTML document. Each method of adding CSS to Web pages has its own benefits.

Resource :

No comments: