Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780596155940/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Foreword
Dan Founder, SimpleBits (http://www.simplebits.com)Salem, Massachusetts Cederholm
Founder, SimpleBits (http://www.simplebits.com)Salem, Massachusetts
Any great chef will tell you that the key to creating good food is using quality ingredients. Author Christopher Schmitt has just gone shopping for you. By compiling hundreds of CSS recipes into this single book, hes giving you a one-stop shop where you can pick up the ingredients to create stylish, flexible web pages.
When I was first learning the wonders of CSS, trial and error prevailed as my primary means for discovering its creative powers: Hmm, Id like to turn this list into a horizontal navigation bar, or I need to stylize the components of a form using CSS for a client. Several hours (or days) would go by after plugging in various CSS rules, removing some, and experimenting with endless combinations. This hit-or-miss approach worked (at times), and although a curious person like me may even consider it fun, it sure ate up a lot of time in the process.
I wish Id had this book. Instead of stumbling upon the solution for styling every element of the page, I could have just thumbed through CSS Cookbook , grabbed the recipe, and started baking. The guesswork wouldve been eliminated, and I could have instead spent my time doing what I love to do best: creating.
The modular nature of this book makes it an indispensable reference for designers and developers of any caliber. Posed with problems from how best to handle typography, links, and navigation to even entire page layouts, Christopher clearly explains not only the styles necessary to complete the task, but also the caveats that may be attached for certain browsers. By additionally explaining the helpful workarounds to everyday CSS problems, hes arming you with the critical knowledge you need to be a successful CSS designer.
For example, a recent article told of a common usability problem: when posed with a Submit button at the end of a form, some users just cant shake their double-clicking habits. The button may get clicked twice, with the results of the form getting duplicated. What to do? A solution wasnt offered in the aforementioned article. However, unsurprisingly, theres a recipe in this very book thatll solve this little problem using CSS and a dash of JavaScript.
And thats the heart of this books purpose: real problems and the goods that will deliver real results. Youve heard about how CSS will simplify your life, making pages lighter and easier to maintain. Now its time to start using it, and with this book, youll have one less excuse not to.
So, my advice is to clear off a space on your desk because CSS Cookbook will take up permanent residency in the corner. Hopefully for you, that spot will be easily within arms reach.
Preface
Christopher Fall 2009http://christopherschmitt.com/http://twitter.com/teleject Schmitt
Fall 2009http://christopherschmitt.com/http://twitter.com/teleject
Every book tells a storyeven books on web design tips and techniques.
This book is about Cascading Style Sheets, or CSS as its commonly abbreviated. CSS is a simple standardized syntax that gives designers extensive control over the presentation of their web pages and is an essential component of web design today.
Compared to 1990s-era development techniques, CSS gives web designers greater control over their designs so that they can spend less time editing and maintaining their websites. CSS also extends beyond traditional web design to designing and controlling the look of a web page when it is printed.
You dont need any special hardware or software to design web pages. The basic requirements are a computer, a modern browser such as Firefox, Safari, or Internet Explorer for Windows (to name a few), and your favorite web page editor. A web page editor can be anything from a simple text editor such as Notepad (for Windows) or TextEdit (for the Mac), to a full-fledged WYSIWYG tool such as Adobe Dreamweaver set in code view.
Now you know what the book is about. Let me tell you its story, its history.
Some would say web design officially began when Tim Berners-Lee, inventor of the World Wide Web, put together the first set of web pages. Others would say it began when the center
tag came about due to Netscapes own extension of HTML.
Though it might seem ironic, I happen to believe that this new media really got started with books. The books that helped lead the way to the dot-com boom in the 1990s started with Lynda Weinmans first full-color book about web graphics, Designing Web Graphics (Pearson), which was published in January 1996, and then David Siegels Creating Killer Web Sites (Hayden), published several months later that same year. These two books helped to kick off the web revolution as much as those who invented the technologies that made the Web possible.
However, the methods written in those books, although cutting edge for their time, are out of date in todays context. As I write these pages, it has been 13 years since those initial books were published; the same year Weinmans and Siegels first books about web design came out describing how to use font
tags, nested tables, and single-pixel GIFs was the same year CSS was first introduced.
CSS has come a long way since then. With more than 13 years of development put into it, its only nowwith the advent of Internet Explorer 8 for Windows reaching a large audiencethat web designers, developers, and everyday users of browsers can use CSS2 to its intended potential.
In addition to IE8, other browsers are making their presence known, and are often ahead of Internet Explorer in supporting new features. Browsers such as Firefox, Safari, Chrome, and Opera are implementing the latest specifications of CSS3 and HTML5 as quickly as the World Wide Web Consortium (W3C) Working Groups members are bandying them about.
If you are serious about building todays usable and cutting-edge websites, use CSS and CSS Cookbook , a collection of CSS-based solutions to common web design problems. Together they can help you create your own bit of web design history.
Audience
This book is for web designers and developers struggling with the problems of designing with CSS. With this book, web builders can solve common problems associated with CSS-enabled web page designs.
CSS Cookbook is ideal for people who have wanted to use CSS for web projects but have shied away from learning a new technology. If you are this type of reader, use the solutions in the book one or a few at a time. Use it as a guidebook and come back to it when you are ready or need to learn another technique or trick.