Rebuilding a Site With Standards

Eric A. Meyer

Netscape Communications

Redesigning a Site With Standards

Lining Up For Takeoff

Redesigning With Standards is...

A Typical Page

Visualizing structure

/*  styles to visualize with borders  */
table {border: 1px solid red; margin: 2px;}
th {border: 1px dashed red; padding: 2px;}
td {border: 1px dashed purple; padding: 2px;}
div {border: 1px dashed #888; padding: 2px;}
div div {border: 1px dotted #888;}
div div div {border: 1px dashed #BBB;}
div div div div {border: 1px dotted #BBB;}
div div div div div {border: 1px dashed #DDD;}

/*  styles to visualize with backgrounds  */
table {background: red; margin: 2px;}
th {background: #FCC; padding: 2px;}
td {background: #FCF; padding: 2px;}
div {background: #CBC; padding: 2px;}
div div {background: #BAB;}
div div div {background: #A9A;}
div div div div {background: #989;}
div div div div div {background: #878;}
div div div div div div {border: 1px dotted black;}

Step One: Flush the fonts

Step Two: Strip the Spacers

Step Three: Further Simplification

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="/antarctic/">Antarctica</a></td>
</tr>
<tr>
<td><a href="/asia/">Asia</a></td>
</tr>
<tr>
<td><a href="/austral/">Australia</a></td>
</tr>
<tr>
<td><a href="/europe/">Europe</a></td>
</tr>
<tr>
<td><a href="/india/">India</a></td>
</tr>
<tr>
<td><a href="/northam/">North America</a></td>
</tr>
<tr>
<td><a href="/southam/">South America</a></td>
</tr>
</table>
<ul>
<li><a href="/antarctic/">Antarctica</a></li>
<li><a href="/asia/">Asia</a></li>
<li><a href="/austral/">Australia</a></li>
<li><a href="/europe/">Europe</a></li>
<li><a href="/india/">India</a></li>
<li><a href="/northam/">North America</a></li>
<li><a href="/southam/">South America</a></li>
</ul>

Step Four: Add Class and ID

<table cellspacing="0" id="masthead">
<tr>
<td id="title">Travel Guide</td>
<td id="advert"><img src="ad.gif" height="60" width="234" alt="advertisement"></td>
</tr>
</table>

<td id="summary">

<h3>Ragged Point Inn & Restaurant</h3>
<h4>Ratings</h4>
<table cellspacing="0">
<tr class="odd">
<td>Amenities</td>
<td class="r3">***</td>
</tr>
<tr class="even">
<td>Location</td>
<td class="r5">*****</td>
</tr>
<tr class="odd">
<td>Dining</td>
<td class="r5">*****</td>
</tr>
<tr class="even">
<td>Service</td>
<td class="r5">*****</td>
</tr>
<tr class="odd">
<td>Overall</td>
<td class="r5">*****</td>
</tr>
</table>

<h4>Price</h4>
<ul>
<li>$180 - $250 / night<br>seasonal rates</li>
</ul>

<h4>Contact</h4>
<ul>
<li><a href="http://www.raggedpointinn.com/">www.raggedpointinn.com</a></li>
<li><a href="mailto:info@raggedpointinn.com">info@raggedpointinn.com</a></li>
<li>(805) 927-4502</li>
</ul>

<h3>Nearby Stops</h3>
<ul>
<li><a href="http://www.hearstcastle.com/">Hearst Castle</a></li>
<li>Cambria, CA</li>
<li>Los Padres National Forest</li>
</ul>

<div class="traveltip">
<b>Traveler's Tip</b><br>
Call to reserve a room at least six weeks in advance of your arrival,
double that in the summer.
</div>

</td>

Let the REstyling Begin!

body {margin: 4px; color: black; background: white;}
a:link {color: #990000;}
a:visited {color: #990099;}
table {width: 100%; margin: 0;}
table td {padding: 0; border-width: 0; vertical-align: top;
  font-family: Verdana, Arial, Helvetica, sans-serif;}

The Top of the Page

#title {vertical-align: bottom; color: #442200;
   background: transparent url(topbg.gif) top left;
   font: bold 200% Arial, Helvetica, Verdana, sans-serif;}
#advert {width: 234px;}
#content-top td {vertical-align: middle; color: white;
  font-weight: bold; padding: 0.1em 0.2em 0;}
tr td#sidetop {background: #663300;
  font: bold 115% Arial, Helvetica, Verdana, sans-serif;
  padding: 0.25em 0 1px 0.33em;}
#crumbs {background: #997753; font-size: 85%;}
#crumbs a:link {color: white;}
#crumbs a:visited {color: gray;}

The Navbar

#navbar {width: 120px; background: #EBDAC6;}
#navbar ul {list-style: none; margin: 3px 0; padding: 0;}
#navbar li {border-bottom: 1px solid #A98763;
  padding: 0.1em 0 0 0.33em;}

Recreating the Content

#content {padding: 0 42px;
  font-family: Arial, Verdana, Helvetica, sans-serif;}
#content h1 {font-weight: bold; font-size: 180%;
  color: #602020; border-bottom: 3px solid #804040;
  padding-bottom: 2px; margin-top: 17px;}
.pullquote {float: right; width: 140px; color: #A09080;
   border: solid #908070; border-width: 7px 0;
   font: bold 130% Arial, Helvetica, Verdana, sans-serif;
   padding: 3px 2px; margin: 1px 7px;}

Basic Styles for the Summary

#summary {font-size: 66%; width: 148px;}
#summary table {font-size: 120%; margin: 0;}
#summary td {padding: 1px;}
#summary h3 {font-size: 125%; padding: 1px 2px; margin: 0;
  background: #774411; color: white; text-align: center;}
#summary h4 {background: #D6B58C; text-align: center;
  font-weight: bold; font-size: 100%; margin: 0; padding-bottom: 1px;}

More Summary Styles

#summary ul {list-style: none; margin: 0; padding: 0;}
#summary li {margin: 0.25em 0;}
tr.even td {background: #F7F0E7; width: 50%;}
td.r3 {color: #666;}
td.r5 {color: #060;}
.traveltip {border: 3px solid #804040; background: #EBDAC6;
  text-align: center; margin-top: 1.5em; padding: 8px;}

Fixing the Footer

#footer td {vertical-align: middle; font-size: 66%;
  border-top: 3px solid #EFE1D1;}
#feedback {text-align: center; padding: 0.2em;
  background: #EFE1D1;}
#footer #tg {font-size: 85%; text-align: center;}
#copyright {text-align: right; font-style: italic; color: #999;}

Comparing the Two

Approach HTML size CSS size Page weight
HTML-only 10.36KB -- 10.36KB
HTML+CSS 4.30KB 2.33KB 6.63KB
Savings 6.06KB -2.33KB 3.73KB

Taking Things Further

Positioning (And Not)

#navbar {position: absolute; width: 120px; top: 0; left: 0;
  font-size: 85%;}
#content {margin: 0 148px 0 115px; font-size: 85%;}
#summary {position: absolute; top: 0; right: 0; margin: 0;}

Establishing a Container

#main {position: relative;}

Filling Out the Navbar

#content {margin: 0 148px 0 0; border-left: 120px solid #EBDAC6;
  font-size: 85%;}

Re-Adjusting the Footer

#feedback {width: 120px;}
#copyright {width: 148px;}

Some Caveats

Wrapping It Up

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Travel Guide: Ragged Point Inn</title>
<style type="text/css">
body {margin: 4px; color: black; background: white;
font-family: Verdana, Arial, Helvetica, sans-serif;}
table {width: 100%; margin: 0;}
table td {padding: 0; border-width: 0; vertical-align: top; font-size: 85%;}
a:link {color: #990000;}
a:visited {color: #990099;}
#title {vertical-align: bottom; color: #442200;
background: transparent url(topbg.gif) top left;
font: bold 200% Arial, Helvetica, Verdana, sans-serif;}
#advert {width: 234px;}
#content-top td {vertical-align: middle; color: white;
font-weight: bold; padding: 0.1em 0.2em 0;}
tr td#sidetop {background: #663300;
font: bold 115% Arial, Helvetica, Verdana, sans-serif;
padding: 0.25em 0 1px 0.33em;}
#crumbs {background: #997753;}
#crumbs a:link {color: white;}
#crumbs a:visited {color: gray;}
#navbar {width: 120px; background: #EBDAC6;}
#navbar ul {list-style: none; margin: 3px 0; padding: 0;}
#navbar li {border-bottom: 1px solid #A98763;
padding: 0.1em 0 0 0.33em;}
#content {padding: 0 42px 1.5em;}
#content h1 {font-weight: bold; font-size: 180%;
color: #602020; border-bottom: 3px solid #804040;
padding-bottom: 2px; margin-top: 17px;}
.pullquote {float: right; width: 140px; color: #A09080;
border: solid #908070; border-width: 7px 0;
font: bold 130% Arial, Helvetica, Verdana, sans-serif;
padding: 3px 2px; margin: 1px 7px;}
#summary {font-size: 66%; width: 148px;}
#summary table {font-size: 100%; margin: 0;}
#summary td {font-size: 100%;}
#summary td {padding: 1px;}
#summary h3 {font-size: 125%; padding: 1px 2px; margin: 0;
background: #774411; color: white; text-align: center;}
#summary h4 {background: #D6B58C; text-align: center; font-weight: bold; font-size: 100%; margin: 0; padding-bottom: 1px;}
#summary ul {list-style: none; margin: 0; padding: 0;}
#summary li {margin: 0.25em 0;}
tr.even td {background: #F7F0E7; width: 50%;}
td.r3 {color: #666;}
td.r5 {color: #060;}
.traveltip {border: 3px solid #804040; background: #EBDAC6;
text-align: center; margin-top: 1.5em; padding: 8px;}
#footer td {vertical-align: middle; font-size: 66%;
border-top: 3px solid #EFE1D1;}
#feedback {text-align: center; padding: 0.2em;
background: #EFE1D1;}
#footer #tg {font-size: 85%; text-align: center;}
#copyright {text-align: right; font-style: italic; color: #999;}
</style>
</head>
<body>

<table cellspacing="0">
<tr>
<td id="title">Travel Guide</td>
<td id="advert"><img src="ad.gif" height="60" width="234" alt="advertisement"></td>
</tr>
</table>
<table cellspacing="0">
<tr id="content-top">
<td id="sidetop">Destinations</td>
<td id="crumbs" colspan="2"><a href="/northam/">North America</a> >
<a href="/northam/west/">Western US</a> >
<a href="/northam/west/ca/">California</a> >
<a href="/northam/west/ca/mid/">Mid-state</a> >
<a href="/northam/west/ca/mid/pch">Pacific Coast Highway</a> ></td>
</tr>
<tr>
<td id="navbar">

<ul>
<li><a href="/antarctic/">Antarctica</a></li>
<li><a href="/asia/">Asia</a></li>
<li><a href="/austral/">Australia</a></li>
<li><a href="/europe/">Europe</a></li>
<li><a href="/india/">India</a></li>
<li><a href="/northam/">North America</a></li>
<li><a href="/southam/">South America</a></li>
</ul>

</td>
<td id="content">

<h1>Ragged Point Inn</h1>

<p>
The views from the Ragged Point Inn are as spectacular as any along the coast. Every room in the inn faces a sheer drop to the ocean; we recommend asking for one of the few second-floor rooms for an even better view. When the time of year is right, it's not uncommon to see migrating whales just offshore.
</p>

<div class="pullquote">
Repeat customers are known to come from as far away as Virginia
</div>

<p>
The rooms are a touch spartan, but comfortable and spacious. The rooms do not have telephones, and in fact the only way to call the outside world is via a payphone just outside the lobby building (or a cell phone, if reception permits). Some travelers may find this unacceptable, but they'll be missing out on a wonderful experience. If you go with a romantic retreat in mind-- one of the best ways to experience Ragged Point-- then you'll love the feeling of seclusion. The rooms do have satellite television, but we aren't sure about the channel selection since we never actually turned on the TV.
</p>
<p>
As wonderful as the views may be, however, it's the food at the Ragged Point Restaurant that keeps most regulars coming back again and again. Chef Roger Wall prepares dishes that taste worlds better than those found in most big-city five-star restaurants, using fresh local ingredients and combining them in innovative ways. Repeat customers are known to come from as far away as Ohio and Virginia! It's almost impossible to make recommendations because everything is so good, but we are practically compelled to mention the rack of lamb, which was indescribably delicious. The prices are typical for restaurants on the PCH, but with food this good you'll swear you've been undercharged.
</p>
<p>
Located about two hours south of the Monterey Peninsula and 30 minutes north of Cambria, the Ragged Point Inn is the perfect getaway for a week or a weekend. It's also worth a single night's stay if you're passing through, but its relative remoteness makes it a difficult (if rewarding) single-night destination on its own terms.
</p>

</td>
<td id="summary">

<h3>Ragged Point Inn & Restaurant</h3>
<h4>Ratings</h4>
<table cellspacing="0">
<tr class="odd">
<td>Amenities</td><td class="r3">***</td>
</tr>
<tr class="even">
<td>Location</td><td class="r5">*****</td>
</tr>
<tr class="odd">
<td>Dining</td><td class="r5">*****</td>
</tr>
<tr class="even">
<td>Service</td><td class="r5">*****</td>
</tr>
<tr class="odd">
<td>Overall</td><td class="r5">*****</td>
</tr>
</table>

<h4>Price</h4>
<ul>
<li>$180 - $250 / night<br>seasonal rates</li>
</ul>

<h4>Contact</h4>
<ul>
<li><a href="http://www.raggedpointinn.com/">www.raggedpointinn.com</a></li>
<li><a href="mailto:info@raggedpointinn.com">info@raggedpointinn.com</a></li>
<li>(805) 927-4502</li>
</ul>

<h4>Nearby Stops</h4>
<ul>
<li><a href="http://www.hearstcastle.com/">Hearst Castle</a></li>
<li>Cambria, CA</li>
<li>Los Padres National Forest</li>
</ul>

<div class="traveltip">
<b>Traveler's Tip</b><br>
Call to reserve a room at least six weeks in advance of your arrival, double that in the summer.
</div>

</td>
</tr>
<tr id="footer">
<td id="feedback"><a href="/feedback.html">Feedback - Contact</a></td>
<td id="tg">Travel Guide</td>
<td id="copyright">Copyright 2002</td>
</tr>
</table>

</body>
</html>