How to write very basic HTML

Here are a minimal HTML example, my personal home page, some comments on the significance of markup (as opposed to layout) and the base documents for the language HTML.

The format of a URL is scheme:[//host.domain[:port]][/path/]filename where scheme is one of:

file
a file on your local system or on an anonymous ftp server,
http
a file on a WWW server,
gopher
a file on a gopher server,
WAIS
a file on a WAIS server

news or telnet (not explained in the docs and, supposedly, rarely used). The port number can usually be omitted from a URL.

Here's a named anchor and here, rather perversely, is a reference to it followed closely by a second, which exploits the fact that it's in the same file (but one should always prefer to put an id="…" attribute on some other element rather than add a separate <a>…</a> just for the sake of giving it a name="…" attribute).

The descriptive list above could, as readilly, be done as a numbered (or ordered) list by using OL in place of DL – or with an un-numbered (a.k.a. un-ordered) list by using UL – and replacing DT .. DD tags around crucial bits (file, http, …) with an initial LI tag. Naturally, lists can be nested.

The equivalent for verbatim is the PRE tag. For extended quotes, use BLOCKQUOTE. You can also add arbitrary comments, delimited by double-dash at each end, inside !-tagged items. Some browsers don't handle that correctly. You can break a line wherever you like with the BR tag (but if the reason you're doing it is to insert a paragraph break, use P tags properly instead): if you also want to insert a horizontal rule, use the HR tag.


The IMG tag enables inclusion of an image, supplied via its SRC attribute. To control its alignment with the nearby text, use the ALIGN attribute; default is ALIGN = bottom putting the text level with the bottom of the picture (but it's best to do such styling via style-sheets). You can also supply, via the ALT attribute, an alternative text to display if the image cannot be displayed (e.g. because the reader doesn't support your image format, or is rendering to speech).

Fonts

Raw fonts get you

If those didn't work in your displayer, and it has font capabilities, try changing font settings. For citations, use the CITE tag; as with TeX, for emphasis use the EM tag. Use VAR for variables, STRONG for bold emphasis, CODE for code, SAMP for samples (which seems to mean literal text after the manner of TT), KBD for key-names (C-M-f) and DFN for definitions.

HTML also supports escape sequences for all characters in the ISO-8859 Latin-1 character set. The SGML (Standard General Markup Language, I think) of which HTML (HyperText Markup Language) is a special case, supports Greek letters by putting their names between & and a semi-colon. (Very early in the history of the web, at least in some places, I saw greek letters in the form &<various>gr; where <various> was generally the roman letter(s) corresponding to the desired letter - eg &agr; for alpha, &bgr; for beta, &thgr; for theta and so on.) See the link at start of this paragraph for exact details and a fuller bestiary.


Valid CSSValid HTML 4.01 Written by Eddy.