By Janine Dalton
Web Developer
Cascading Style Sheets (CSS) is the language used for formatting the appearance of web pages. Its use was recommended by the W3C, the chief standards body for the web, as far back as December 1996. However, it has only come to the fore in more recent years, when it became widely supported by browsers and web designers realised its true potential.
For designers, used to having their creativity curbed by the restrictions that HTML, a language never intended for formatting, imposes and for developers therefore plagued by having to overcome these limitations using workarounds like deeply nested tables, one pixel transparent gifs and the like, it is no wonder that CSS is seen as a saviour.
Firstly, the dream of pixel perfect positioning is now a reality thanks to CSS. You can specify everything from the exact margins of your page right down to the line spacing of your paragraphs. The designer controls the appearance of the web page in ways simply not possible in HTML. For example, you can specify any size text instead of being limited to the seven font sizes available in HTML.
While this aspect of CSS is enough to excite the creatively minded, CSS is about much more than making pages look pretty. The primary philosophy behind CSS is the separation of presentation from content. Anyone responsible for redesigning a large website, changing every font tag as they go, will appreciate why this is a good idea! By storing all web page styles in an external file, which is then attached to each page, you will only ever need to edit one file in order to implement site wide formatting changes. In fact, if you fully embrace CSS, and replace traditional table based layouts with a div based layout implemented using style sheets, there is the tantalising prospect of the ability to completely change the physical layout of your site in this way. For instance, you could move your navigation bar from the top of the page to the left hand side, just by changing your style sheet.
Another reason for keeping style and structure separate is accessibility. CSS enables you to tailor the presentation of your site to each medium, allowing your site to reach the broadest possible audience. For example, how impressed would a disabled visitor accessing your site with a screen reader or aural device be by your breathtaking graphics and small text? By simply attaching a separate style sheet to your web page, specifying high contrast text only styles optimised for this medium, the device will automatically format all content appropriately.
Similarly, even in this computer age, the printed page is here to stay. If you are fed up with creating separate printer friendly versions of your web pages, why not just attach a print style sheet to your existing pages instead? You can even hide large graphics and irrelevant navigation elements or replace them with more appropriate print headers and footers.
While CSS can greatly assist you in developing a superior site, once this is done the focus shifts to promotion. The good news is that using CSS can help tremendously in optimising your site for the search engines. CSS based sites consist of valid, cleaner code which means smaller file sizes and, more importantly, your pages can include proportionately less code mark-up and more spider-friendly, keyword-rich content.
In conclusion, regardless of your perspective, if you are involved in creating web pages, CSS has lots to offer.