Preface

HTML and CSS are old technologies that have seen over a decade of use and continue to evolve. Web developers celebrating their fifteenth year of work have seen all kinds of projects built across a wide variety of browsers, experimented with different features, and noted their successes and failures.

Despite their best efforts, the people who created HTML and CSS didn’t always get it right. Some experiments didn’t work out very well. At the same time, some pieces proved even more useful than expected. Mastering these technologies requires figuring out which pieces of the specs are cruft, in urgent need of abandonment, and which are gold, deserving maximum use. Focusing on HTML and CSS best practices does more than help you create sites that work: it lets you build more effective sites more efficiently, with much lighter long-term maintenance costs.

The Who and What of This Book

Hopefully you’re holding this book because you read a glowing review on one of your favorite websites, or because somebody you know said that you absolutely need to read it. (An author can dream.)

Still, you need more information than that. Is this book for you?

If you and your priorities are described in the paragraphs that follow, then you should walk out of the store with this book under your arm, or at least sit down in the nearest available chair and start reading.

What Are the Good Parts?

There’s no getting around the fact that long stretches of HTML and CSS are boring. I mean sleep-through-it boring. In this way, web technologies are like a certain class of movies: viewers find themselves wanting to skip the exposition so they can watch the good parts.

This book attempts to cater to that sentiment. All of the exposition—which I do invite the reader to tackle—is tucked away into Chapters 2 and 3, available for a quick “rewind” if you realize that you might have missed something.

The nonexpository parts are about making cool stuff happen: nailing down faithfulness to composites, getting the upper hand over bugs, building template markup that can survive redesigns, and manifold other topics.

What You Should Know Before You Read This Book

This book makes one basic assumption: that you’re familiar with the scope of HTML 4.01 elements, CSS selectors, and CSS property/value pairs. The companion website for this book includes reference tables that link to exhaustive descriptions of HTML and CSS on third-party sites, but it will be far easier to follow along if you’re already familiar with the capabilities of HTML and CSS.

In addition, this book will be easier to digest if you’ve gained an understanding of the separation of behavior, presentation, content, and structure into separate layers within a site or application.

If you feel uneasy about any of this, O’Reilly’s Definitive Guides and Pocket References for HTML and CSS come highly recommended.

For the benefit of readers who may have overestimated their knowledge, the basics of page, stylesheet, and element structure are covered as briefly as possible.

The Ideal Reader

You might be an ideal reader of this book if:

  • You’re confident when the time comes to start building the server side of an application, but redesigns get on your nerves because you’re forced to dive back into the code and revise the bits of markup that are interspersed within it. The most effective solution to this problem is called the “CSS Zen” technique, exemplified by Dave Shea’s CSS Zen Garden. This book explains CSS Zen—structuring production of markup so that redesign efforts can be confined to stylesheets—from a perspective suited to engineers.

  • You’re skilled at the use of a web-centric Integrated Development Environment (IDE) such as Adobe Dreamweaver or Microsoft Visual Studio, but your expectations routinely collide with its limitations. Left unattended, an IDE typically inserts all manner of cruft (i.e., “excess; superfluous junk”) into web materials, egregiously violating the KISS (Keep It Simple, Stupid) Principle. This occurs because IDEs are one-size-fits-all solutions. This book explains HTML and CSS in enough detail that you can start configuring your tools of choice to handle the specific cases you work with every day.

  • You have—for whatever reason—a lot of bad habits that need to be superseded by good ones. Some of you probably still use HTML to manage presentation as well as structure, and CSS meanwhile is terse to the point of impenetrability. This book’s perspective places CSS in a useful light.

  • You’re a print-trained graphic designer who needs to understand the strengths and limitations of the web medium in order to avoid career stagnation. You’ve looked at HTML, you’ve looked at CSS, and you believe they fit together—but you just don’t understand how. This book takes a close look at the connection between the two, so that you can get the hang of putting design elements exactly where you want them.

  • Your professional role encourages or perhaps even requires you to develop to statutory accessibility requirements, or internally mandated cross-media usability requirements. Without CSS-ready markup, there’s little hope of developing cross-media-friendly sites, much less sites accessible to impaired users. This book explains how to develop a site so that accessibility requirements can be met without needing to build multiple sites in parallel.

  • You’re already a specialist in some skill set outside of the presentation layer, and you want to make your job easier. Put simply, narrower specialization leads to reduced skill overlap, which in turn poses barriers to intrateam communication. This book lays out the priorities of the developers whose work lies closest to site visitors, and in so doing gives you the information you need to communicate more effectively with your teammates.

  • You’re tired of beating your head against the brick wall more commonly known as Internet Explorer 6. Several sites, particularly Position Is Everything, delve into solutions for the nightmare that is stylesheet authoring for legacy versions of Internet Explorer. However, most online resources are tuned to specific bugs and behaviors. In Chapter 14, you’ll find condensed explanations of the quirks “under the hood” that cause unwanted collisions and blowouts, as well as a cookbook of practices and techniques that will help you avoid many such problems altogether.

A Warning About Familiarity (or Lack Thereof)

Chances are that you are already familiar with some of the contents of this book. Because its audience comprises a wide range of specialists, there may be times when material meant for engineers is painfully obvious to designers, and vice versa. There may also be times when the discussion begins to remind you of a contentious argument. Creative and implementation decisions are too often made from a position of political strength instead of merit, and it’s my hope that this book can be used to support merit-based arguments against Bad Ideas.

If instead everything in this book is new, it’s possible that you’ve gotten a bit ahead of yourself. The book’s companion website is built in large part to meet the needs of folks like you, by way of ensuring that all purchasers of this book will be able to get some value from it. However, if the material does seem a bit advanced, you can expect some difficulty. The best way of dealing with that is to be patient, and ask lots of questions of colleagues and associates.

Get HTML & CSS: The Good Parts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.