Subscribe here for our
FREE email newsletter

Custom Search

Cascading Style Sheets

explanation of style sheets - by the guys who invented them

What are 'cascading style sheets (CSS)'? Answer - "a simple mechanism for adding style (fonts, colors, spacing) to Web documents". If you have spent any time wrestling with HTML code, trying to control the layout and appearance of text on a page, you will know one thing. It's an almost hopeless task. What looks good in Netscape might be a dog's breakfast in Internet Explorer, and it will probably look even worse in Opera.

Cascading Style Sheets - Click to order from Amazon.co.uk As Lie and Bos explain: "HTML doesn't pay much attention to the document's appearance" - so CSS offers "a simple language that can be read by humans". It's basically another system of coding which can be added to .htm pages which allows the author more control over the physical appearance of what's on the page. It also begins the process of separating appearance from content.

Click for details at Amazon.com

Click for details at Amazon.co.ukThey start with an introduction to basic HTML (which they claim can be learned in less than a day!) before describing CSS in all its detail. This is where any normal user will encounter the first difficulty - because the code is defined in a relentlessly arbitrary jargon - of 'selectors', 'declarations', 'properties', and 'values'. Then they go on to describe the variety of ways in with a style sheet can be 'glued' to a document. This fortunately offers the user more than one way to achieve a particular effect. But there's no escape from the abstract style:

"Recall from Chapter 1 that an attribute is a characteristic quality, other than the type or content of an element. In that chapter we discussed the attributes HREF, SRC, and ALT. In this chapter we will discuss two new attributes that have been added to all HTML elements to support style sheets"

But what it lacks in accessibility, it makes up for in thoroughness, and fortunately, the book is very well illustrated. They cover all the features of this mini-technology which Web designers are likely to require - fonts, spacing, layers, colours, and the tricky issue of forward compatibility. They describe the issues of cascading and inheritance which advanced users might wish to exploit. I would have liked to see the page code for some of the wonderful examples they reproduce in full colour, but at least they show what CSS can do.

Style sheets may well become more popular as the early generations of browsers which didn't support them fade into the ancient history of the Web [that is, anything more than five years old]. If you're interested in exploring the possibilities of CSS, then you might as well get the story from the guys who invented the idea - and make sure you buy the latest (second) edition, which contains a useful comparison of browser-support. As the HTML standard is developed to keep pace with browsers in versions 4.0 and 5.0, this is a book with a bright future.

© Roy Johnson 1999     [other WEB DESIGN books]


Hakon Lie and Bert Bos, Cascading Style Sheets: Designing for the Web, New York/London: Addison-Wesley, (second edition) 1999, pp.432, ISBN 0201596253

Click for details at Amazon.com Click for details at Amazon.co.uk Discounts of 40% at Amazon!


Mantex - PO Box 100 - Manchester M20 6GZ - UK
Tel: +44 0161 432 5811 — Email: info@mantex.co.uk
Copyright © Mantex 2000—2008