HTML and CSS Reference
website, an entry is also made to the error_log ile, indicating what went
wrong. his is what a typical error log message looks like when a requested ile
cannot be found (status = 404):
[Thu Nov 08 19:47:14 2010] [error] [client 192.168.0.1]
File does not exist: /var/www/www.example.org/public_ html/favicon.ico
his error likely occurred because the ile about.html, which was requested
a couple of seconds earlier, had a link in the document's head element for a
“favorites icon” ile named favicon.ico, which does not exist.
Unless you are totally unconcerned about who visits your website or are
uncomfortable about big companies tracking your site's traic patterns, you
should sign up for a free Google Analytics account and install its tracking
code on all the pages that should be tracked. Blogs and other CMS systems
typically include the tracking code in the footer template so that it is called
with every page. he tracking report shows the location of visitors, the pages
they visited, how much time they spent on the site, and what search terms were
used to ind your site. Other major search engines also ofer free programs for
tracking visitors to your website.
his is the website's document root. Every website has exactly one document
root. htdocs, www, and html are other names commonly used for this direc-
tory. In Example 5.1, the document root directory, public_html, contains three
HTML iles: the default index ile for the home page and the (conveniently
named) about and contact iles.
here is no requirement to have separate subdirectories for images, CSS
iles, and scripts. hey can all reside in the top level of the document root
directory. I recommend having subdirectories, because websites tend to grow
and will need the organization sooner or later. here is also the golden rule of
computer programming: Leave unto the next developer the kind of website you
would appreciate having to work on .
For the website shown in Example 5.1, the CSS statements are separated
into two iles. he ile named layouts.css has the CSS statements for position-
ing and establishing loating elements and deining their box properties. he
ile named styles.css has the CSS for elements' typography and colors. Many
web developers put all the CSS into a single stylesheet. However, I have found
it useful to have two iles, because I typically work with the layouts early in the
development process and tinker with the styles near the end of a project.