Sticktime Publishing


The CSS Book

Cascading Style Sheets, or CSS, is the primary language used to define how a webpage looks. HTML describes the structure of the content of a document; CSS is in the business of telling the user agent (a.k.a. your web browser) how that HTML document should appear.

So many considerations present themselves that should really be of no concern to the developer when marking up the structure of a document. What font should be used? What color or colors should the text, headings, titles and background be? Should an image be used for the background or a solid color or how about a gradient to draw the eye? Should different parts of a page have their own backgrounds? These aee issues quite separate from the tasks of discerning things like the main body text from the text of asides and other peripherally-related sections; whether a line of text is a section header and that (but not how) it is to be offset as a secondary header, a tertiary header, or beyond; and whether (not how, remember) to separate a section, say, the website’s navigation links, from the main flow of the document.

Additionally, humans are not going to be the only readers of your document. There are plenty of legitimate uses for automated ‘spiders’ beyond the obvious big search engines’ cataloging of the Internet. These automated consumers of whatever goods and/or services your website provides (your website is at least of some use to somebody out there, right?) don’t care about fonts and colors and the spacing of different elements of the page.

It’s a best practice in web development to separate the content and the definition of that content from the instructions that define way that content should appear. The trouble is that the appearance of content can be embedded in HTML, so many developers get lazy (myself included) and use, for instance, the obsolete <CENTER> tag instead of specifying that a certain type of element should be presented in a certain way in the separate CSS document.


CSS comments begin with a slash and an asterisk (/*) combination and end with an asterisk and a slash (*/) combination. The same comment syntax is used for comments spanning single line and multiple lines.

Single Line
p { color: green; } /* Colors text of P elements green */
Multiple Lines

Unfortunately, at this time CSS