Book HomeHTML & XHTML: The Definitive GuideSearch this book

Chapter 17. Tips, Tricks, and Hacks

Contents:

Top of the Tips
Trivial or Abusive?
Custom Bullets
Tricks with Tables
Transparent Images
Tricks with Windows and Frames

We've sprinkled a number of tips, tricks, and hacks throughout this book, along with style guidelines, examples, and instructions. So why have a special chapter on tips, tricks, and hacks? Because it's where many readers will leaf to when they pick up this book for the first time. HTML and XHTML are the languages, albeit constrained, that make the World Wide Web the exciting place that it is. And interested readers want to know, "How do I do the cool stuff ?"

17.1. Top of the Tips

The most important tip for even veteran authors is to surf the Web for yourself. We can show and explain a few neat tricks to get you started, but there are thousands of authors out there combining and recombining HTML and XHTML tags and juggling content to create compelling and useful documents.

Get copies of Netscape Navigator (the browser portion of Communicator), Internet Explorer, and whatever other browser you feel comfortable operating, and cruise. Collect web site URLs from friends, business associates, and the traditional media. Even local TV and radio stations have taken to announcing some of their sponsors' web site URLs. And consult the many different web directories like Yahoo, Excite, Lycos, and AltaVista for new and up-to-date addresses for the web sites that suit your lifestyle or business niche.

Examine (don't steal) their pages for eye-catching and effective pages and use them to guide your own creations. Capture and examine the source documents for the juicy bits. Get a feel of the more effective web collections. How are their documents organized? How large is each document? And so on.

We all learn from experience, so go get it.

17.1.1. Design for Your Audience

We continuously argue throughout the book that content matters most, not look. That doesn't mean presentation doesn't matter.

Effective documents match your target audience's expectations, giving them a familiar environment in which to explore and gather information. Serious academicians, for instance, expect a journal-like appearance for a treatise on the physiology of the kumquat: long on meaningful words, figures, and diagrams and short on frivolous trappings like cute bullets and font abuse. Don't insult the reader's eye, except when exercising artistic license to jar or in order to attack your reader's sensibilities.

By anticipating your audience and designing your documents to appeal to their tastes, you also subtly deflect unwanted surfers from your pages. Undesirables, such as penniless college students surfing your commercial site[86], may hog your server's resources and prevent the buying audience you desire from ready access to your pages.

[86]Not that there's anything wrong with that. We both started out as penniless college students and years later, wound up writing for O'Reilly & Associates.

You can use subtle colors and muted text transitions between sections for a classical art museum's collection to mimic the hushed environment of a real classical art museum. The typical rock-'n'-roll crazed web surfer maniac probably won't take more than a glance at your site, but the millionaire arts patron might.

Also, use effective layout to gently guide your readers' eyes to areas of interest in your documents. Do that by adhering to the basic rules of document layout and design, such as placing figures and diagrams nearby -- if not inline -- with their content reference. Nothing's worse than having to scroll up and down the browser window in a desperate search for a picture that can explain everything.

We won't lie and suggest that we're design experts. We aren't, but they're not hard to find. So, another tip for the serious web page author: seek professional help. The best situation is to have design experience yourself. Next best is to have a pro looking over your shoulder, or at least somewhere within earshot.

Make a trip to your local library and do some reading on your own, too. Even better yet, browse the various online guides. Check out Web Design in a Nutshell, Second Edition (O'Reilly & Associates). Your readers will be glad you did. Section 1.7, "Tools for the Web Designer"

17.1.2. Boilerplate Documents

The next best tip we can give you is to reuse your documents. Don't start from scratch each time. Rather, develop a consistent framework, even to the point of a content outline into which you add the detail and character for each page. You might even endeavor to create style sheets, so that the look and feel of your documents remain consistent.

Here's our contribution to help start your boilerplate document collection. The following sources contain what the HTML and the XHTML standards currently tell us is the minimum content that should appear in every respective document (regardless of what the browsers might let you get away with) and then some added for document clarity. Use them as skeletons for your own documents (they look mighty alike):

<html>
  <head>
    <title>Required; replace this title with your own</title>
  </head>
  <body>
    <h3>Reiterate the title here</h3>
      ...Insert your document's contents here...
    <address>Include your name and contact information
               usually at the end of the document
    </address>
  </body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">
  <head>
   <title>Every XHTML document needs a title</title>
  </head>
  <body>
    <h3>Reiterate the title here</h3>
        ...Insert your document's contents here...
    <address>Include your name and contact information
                  usually at the end of the document
    </address>
  </body>
</html>


Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.