time it is of the utmost imp ortance for the person writing the code. Notice how the start
and end tags of nested elements “see” each other. This “visibility” is made possible by
indenting the content of an element. Th at way, the structure of th e document stand s
out more clearly before th e writer. In such a small document the advantage may not be
evident at first glance, but believe m e, when a document’s size reache s several hundred
lines, you want to have some order in y our code.
Another friendly feature that helps programmers find their way through the chaos
of computer code are comments. In HTML, comments are enclosed in a so-called
comment tag, which starts with a left angle bra cket, an exclamation mark, an d two
hyphe ns (<!– –), and ends w ith two hyphens and a right angle bracket (– –>). For
example:
<!-- This is a comment and will not be visible in the browser. -->
Comments are completely ignored by the browser but quite useful for writing a short
human-readable summary of code, for example. With p roper c omments, you don’t
need to decipher the code every time you need to upgrade it. Even if it is your own
code, human readable remarks will help you trem endously to understand it later. An-
other practical use of comments is to temporarily switch off parts of code during test-
ing and experimenting.
If yo u work in a team, or pla n to make your co de public, it is a go od idea to include
your name, contact information, and a licensing notice in comments at the to p of y our
code. That way, p eople will have a chance to con ta ct you in case they have questions
about the code.
While comments ar e not visible in the browser window, be aware that they are acces-
sible to the web page viewer through the
View page source menu comma nd. So, don’t
use c omments to wr ite filthy remarks about your boss or mother-in-law.
1.5 Formatting a Page
Professor: When I was a little b oy, my mother used to read me fairy tales fro m the
book by Joseph Jacobs, an Australian folklorist, and I still can’t do without them.
That’s why we’re going to mark up the beginning of The Rose-Tree as our next exam-
ple. We will ne ed three more elements f or the job: a main heading (th e <h1> ele ment)
for the title, an image (the <img> element) to include a fancy decorative capital letter,
and quotes (the <q> elemen t) for quoted speech.
In HTML, you can use six different levels of headings defined by the elements from
<h1> to <h6>. <h1> defines the most importa nt heading while <h6> defines the least
important heading. Since our fairy tale on ly has on e heading, we will of course use
the <h1>:
<h1>The Rose-Tree</h1>
With the image element, as you might have guessed, you can include a picture into a
page. You do tha t by specifying the file in which the picture is stored using the src
8 Meeting 1. Content and Structure