Flylib.com

Books Software

 
 
 

THE BOOK S STRUCTURE


THE BOOK'S STRUCTURE

Each chapter of the book describes a certain bulletproof guideline . We'll start by looking at an existing design from the Web, and we'll note why it isn't bulletproof. We'll then rebuild the example using XHTML and CSS, with the goal of improving its flexibility and decreasing its code.

Many of these examples are specific components of the page, which makes it easier to talk about how they might be bulletproofed in chunks . In the final chapter, "Putting It All Together," we'll round up all of the techniques from previous chapters to create a full-page templatereminding ourselves along the way why we've chosen the bulletproof techniques, and illustrating how they all can work together in one place.

The step-by-step nature of each chapter's examples should make it easy to follow alongeven if you are new to using XHTML and CSS in your daily work. Along the way, I'll explain why these Web standards are beneficial, and specifically how each chapter's guideline can improve a Web site's bulletproofness .


THE CONTEXT OF THE BOOK'S EXAMPLES

All of the examples assume a basic page structure that surrounds them. In other words, what is shown in each chapter in terms of XHTML and CSS code happens within an assumed, existing HTML document in between the <body> and </body> .

For instance, the basic framework for the book's examples could be set up like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <title>Page Title</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
    ... example CSS goes here ...
  </style>
</head>

<body>
  ... example markup goes here ...
</body>
</html>

note

I'm using the XHTML 1.0 Transitional DOCTYPE here, but you could choose any XHTML DOCTYPE flavor you'd like. Wondering what the heck a DOCTYPE is? Not to worry, I'll talk more about them in the "How to validate" section of Chapter 6 .


While the CSS is placed in the <head> of the page for convenience, it should eventually be hidden from old, tired browsers (Netscape Navigator 4.x, for example). This hiding is quite common, enabling designers to use advanced CSS for layout (as we do throughout the book), while offering older browsers that can't handle it a fully readable, CSS-free view of the document.

Hiding CSS from older browsers is commonly done by using the @import method for referencing external style sheets. For example, if we placed all of our styles into a file named screen.css, we could use the @import method to reference that external style sheet by its URL. Because older browsers (like Netscape 4.x) don't understand @import , the styles contained within screen.css will be hidden to them.

<head>
  <title>Page Title</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">

@import url("screen.css");

</style>
</head>


COMMON TERMS USED THROUGHOUT THE BOOK

There are times throughout the book that I'll refer to various browser versions by their abbreviations. For instance, it's much easier to say IE5/Win than "Internet Explorer version 5 for Windows." That said, here's a little list of the shorthand browser version/platform conventions:

  • IE5/Win = Internet Explorer version 5.0 and 5.5 for Windows

  • IE6/Win = Internet Explorer version 6 for Windows

  • IE5/Mac = Internet Explorer version 5 for Macintosh

When describing the common approaches found in the examples used for each chapter, I often refer to nested tables and spacer GIF shims . This describes the traditional techniques often used to build Web sites, in which tables are used to create pixel-perfect but inflexible beasts. Nesting tables inside one another made it easier to precisely align graphics and text, yet the result was a gigantic amount of code with accessibility problems galore.

The term spacer GIF shim refers to the use of a single transparent GIF image that's stretched to various dimensions in order to create gaps, columns , and divisions throughout a page. An unbulletproof Web site will have these littered throughout its markup, adding code and creating a maintenance nightmare.

But there are better ways of accomplishing the same visual goal using lean, meaningful markup and CSS. By embracing these Web standards, we can still create compelling designs that at the same time are flexible and ready for whatever situation is thrown at them. This is Bulletproof Web Design .