|
|
A brief history of
HTML and overview
of its syntax
The HTML Non Standard
The HyperText Markup Language is the document tagging system in
which World Wide Web pages are written. It was originally designed to be
an open standard across the world, but back in about 1995-96,
Netscape and then Microsoft hijacked it, and started introducing their
own proprietary extensions to the agreed specification. The most useful
of their original extensions were incorporated officially into the
mainstream HTML 3.2 standard, which has since been superceded by HTML 4.0.
At the same time, newer developments such as JavaScript, style sheets and
now the prospect of XML have come along, and the mess of incompatible
browsers has remained. Microsoft IE5 supports a lot more standards than
Netscape 4x, but the forthcoming Netscape 5.0 promises to be the world's first
proper standards-based browser. We'll have to see, but for now, we must plough
on with the jumble of intermixed HTML standards and plethora of add-ons. This
guide should help you to produce basic HTML which works in the
current browsers, even if it doesn't meet any of the official standards. None of
the browsers support the standards, so it's impossible to write HTML that does
either.
General Syntax
Documents written in HTML are not as cryptic as they might look:
they simply comprise standard chunks of text, as well as titles, lists,
and table data, interspersed with markup tags. Tags consist of
short command codes called elements enclosed in angle brackets,
and each element is associated with a certain effect, such as making
text bold, centering a paragraph, or including an image. Most effects
require start tags and end tags, which tell the browser when to apply,
and then stop applying, the chosen effect. A start tag looks like
<example> and an end tag looks like
</example>, for all elements. A pair such as this is
technically called a container. Start tags can also contain
attributes within their angle brackets, which are extra
parameters giving you more precise control. You will see many examples
of attributes later in the guide. You can nest tags within each other,
in order to combine the effects of individual elements and produce more
interesting results. There is a great number of elements within the
formal HTML specification, but you actually don't need very many to
create a smart and informative web page. Once you've worked through
this guide, you can try the selection of other web sites, listed in the
"More Help" section at the end. Those will take you on to
more advanced and detailed material on HTML and all its related topics.
Controlling Presentation
Due to the way the web was originally defined, you intentionally
don't have total control over how your pages will look; you specify
logical markup instructions, and the browser will then render
the effects in its own way, though the output should be fairly similar in
all cases. During the reign of Netscape and Microsoft extensions, all sorts
of extra tags started appearing in HTML, allowing you to control
precise details such as font sizes and types. This may sound useful, but
it lead to all sorts of problems, since the web is viewed by people using
a thousand different computer types, all with vastly differing screen
sizes and pixel resolutions. With this in mind, it's very easy to create
something which looks great on your system, but is unreadable to
millions of others. The advent of style sheets
has helped to restore HTML's original purpose: as a markup language,
not a presentation system. In turn, most of the real presentation-oriented
tags have been formally obliterated in the newest HTML 4.0 specification.
The broad concensus these days is that you should use HTML itself to
structure the content your web documents, and style sheets to define
their presentation. This subject area is full of continuing debate and
controversy, but the last point is a very important concept, which is why
we made it here, before you get too engrossed in the details of HTML.
Creating your First Documents
In this guide, the important HTML elements will be presented,
accompanied by a visual example of their effect, where appropriate.
Wherever an end tag is not presented, assume that one is not needed.
Note that all HTML elements are not case sensitive, so although
lowercase has been used throughout this guide, uppercase would be fine,
and many developers use uppercase to help tags stand out. Remember that
HTML files are stored as simple ASCII text files, so to create them,
just use your favourite text editor program. You don't have to do any
compiling or processing; just write them, and load them into your web
browser to view them. When writing HTML, try to spread it out as much
as possible, to make the code easier for you to read when you look back
at it. Leave blank lines between paragraphs, and between sections of
code, and start new tags on new lines. HTML ignores extra spaces and
lines in your code, so you needn't worry about changing the final look
of your document; it'll just make your own development and maintenance
tasks easier.
A final warning: please believe me when I say that HTML scripting is
far more an art than a science, as you battle to find little tricks that make
things work in different browsers. Unfortunately, because Netscape and
Microsoft have thrown the rule books out of the window, you will often
have to as well!
|