Cascading Style Sheets (CSS)are an integral part of websites, allowing the content of many pages to be formatted and reformatted by changing only one file - something which many people now take for granted. It wasn't always as easy as changing one [t:CSS] file. And even now that it is as simple as changing CSS files to affect the way an entire site is formatted, there are lots of tricks for doing different things - and they are compounded by differences in web browsers, the most notable differences from open standards being Microsoft's Internet Explorer.
Because of the incompatibilities, and because of the amount that can be done with CSS, it can be daunting for the new user. It can also be problematic for more experienced users; all the neat tricks and tweaks which can be done aren't always easy to remember. I know that I don't play with CSS every day, and because of it I might forget little things. It can be time consuming trying to 'rehack' a problem, and it certainly comes in handy to have some old code lieing around. The problem with the old code is that it's old, and may not do the same things with newer browsers. Thus, people write CSS cookbooks to give us a hand with these things.
I'd used the first edition of this book and found it useful; it was a solid reference in 2004/2005 which somehow disappeared from my site - probably in Costa Rica at a conference in 20051. When I got an opportunity to get my hands on the second edition, I jumped on it. Updated for Internet Explorer 7 and Firefox 1.5, it's certainly more up to date than the first edition. With Firefox already up to 2.0, there might be some differences - so I checked the Firefox 2.0 release notes and didn't see anything related to CSS, so it would seem the book is completely up to date.
In a robust 502 pages, the book covers a lot of CSS related problems and solutions - 161 subsections in 12 sections (not including the 4 appendices):
- General: The basics of using CSS with HTML and the grounding concepts - perhaps good for learning, certainly good for a refresher. It includes subsections on using CSS with [t:Adobe Dreamweaver] and [t:Microsoft Expression Web Designer].
- Web Typography: Everything you wanted to know about CSS and fonts but were afraid to ask, as well as formatting in various forms - from headers to footers, pull quotes to paragraph indentations. I liked the tweak for styling the first line of a paragraph with an image. I'll have to play with ':first-line' sometime.
- Images: Borders, backgrounds, multiple background images, replacing/overlaying HTML text with images (and replacing HTML text with Flash text), using multiple PNGs with transparency, combining image formats, rounding corners using various techniques, making word balloons (but, sadly, no animal balloons), making images scalable, keeping people from using your images, inserting reflections on your images and using image sprites. Cool chapter, I have to play some more with this.
- Page Elements: Eliminating page margins, controlling the scrollbar, different techniques for centering elements on a page, placing a page border, customizing a horizontal rule and adding a lightbox.
- Lists: All you wanted to know about lists (ordered and unordered) but were afraid to ask, including creating custom image markers for lists and hanging indents.
- Links and Navigation: Changing the way links appear (colors, underlines and removing them), placing icons at the end of links, rollovers with Javascript, text navigation menus and rollovers, and building horizontal navigation menus, navigation menus with access keys, breadcrumb navigations (no pigeons allowed), collapsible and contextual menus, designing a dynamic visual menu and last but not least - applying styles to a web page on the fly (dynamically).
- Forms: Basic and advanced forms- great reference.
- Tables: Adjusting HTML tables with CSS - cell spacing, cell padding, borders, caption style, setting styles within table cells, removing and eliminating gaps from images placed in the table cells, alternating colors in table cells, highlighting effects on table rows, and a pretty cool sample design - a calendar.
- Page Layout: One column, two column - fixed with and flexible multicolumns with floats (CSS jargon, not the things you stick on kids) or positioning. Using floats to display columns in any order, and something I have to find an excuse to play with - asymmetric layout.2
- Print: Printer friendly pages and the CSS files that love them - including a sample design.
- Hacks, Workarounds and Troubleshooting: Easily the most valuable chapter of this book. It's exactly what the title says and it's prbbably the area where the book will flip open by itself over time.
- Designing With CSS: Enlarging text excessively, creating unexpected incongruity (without getting in trouble with your mother), combining unlike elements to create contrast, leading the eye with contrast, checking for enough color contrast, and - emphasizing a quote
The Appendices are full of useful stuff - resources, CSS 2.1 properties and proprietary extensions, selectors, pseudo classes and pseudo lelements, as well as the styling of form elements.
The book itself is easy enough to flip through, and the sections allow one to hone in on what one wishes to do quite easily and the format of 'Problem, Solution, Discussion' keeps everything tight and mentally chewable so you can focus on the monitor. Personally, I loved how the use of the word 'unique' was applied to some of the things Microsoft has done.
I suppose that one could learn CSS from this book - the first chapter covers the basics of CSS quite well - but this book isn't a luxury sedan. It's a sports car, it's meant to be driven. The no nonsense approach to problems and solutions allows one to focus on the actual problems and solutions. Because of this, CSS Cookbook, 2nd Edition scores a KnowProSE.com 8 out of 10; that it comes in PDF as well gets it to a score of 9 out of 10. A very useful reference as well as a refresher for those of us who aren't up to our knees in CSS entrails on a daily basis.
Oh. And don't feed the bear on the cover.
Nov 1, 2006 by Taran Rampersad For those of us who aren't up to our armpits in CSS on a daily basis, the CSS Cookbook, 2nd Edition has followed the path of the first edition in usability as a reference, as well as a refresher. While it's possible to learn CSS from this book, there are other books more focused on that. However, experienced programmers unfamiliar with CSS may find this book useful for getting around CSS.
CSS Cookbook - Great reference on CSS
1I think it ended up in Peru. Without me.
2 Like I don't have enough to do. :-)

Technorati Tags: 




Post new comment