Cascading Style Sheets (CSS) are being used more and more by web designers to layout and format web pages. Although they have been around for several years now many designers have avoided them due to browser incompatibility.
Although compatibility problems still exist they are no longer an issue for most applications. Here I will concentrate here on main features and how they work and why they are used.
You may find yourself using CSS anyway without you knowing as programs like FrontPage use CSS (depends on page setup options) for some of their functionality.
Styles Solve a Common Problem
HTML was originally designed to define content of a document but not document presentation/layout. The layout of document was supposed to be taken care of by browser, without using any formatting tags. The content is defined by using tags like h1,
, table, which basically say "This is a header", "This is a paragraph", "This is a table", by using tags like and so on.
The principal browser vendors, Netscape and Microsoft, competed by adding support for new, proprietary tags (like tag and colour attribute) and technologies that permitted increasingly high-impact Web pages.
These innovations were good for spurring development of Web technology, but they created problems as well. Consequently it became more and more difficult to create Web sites where content of HTML documents was clearly separated from document's presentation and that would be displayed correctly on any browser.
The World Wide Web Consortium (W3C) - consortium responsible for standardizing HTML - created a language called Cascading Style Sheets, or CSS.CSS, unlike HTML, is designed solely to define appearance as efficiently as possible.
It can exist either within HTML or as a linked document, letting developers separate a Web page's content (marked up in HTML) from its presentation (defined by CSS). Both Netscape 4.0 and Internet Explorer 4.0 and later support Cascading Style Sheets.
Style sheets work like templates: you define style for a particular HTML element once (e.g. header tag h1), and then use it over and over on any number of Web pages.
If you want to change how an element looks, you just change style; element automatically changes wherever it appears. (Before CSS, you had to