How to Read HTML Pages

What does An HTML Page Look Like?

HTML files are just text files, and they can be edited with any text editor. This is deceptively simple, because your results will be unpredictable unless you actually have some idea of what you are doing. Armed with some knowledge, however, you can effectively create and maintain Web sites with free software.

Even though HTML tags appear in plain text, they use a very specific syntax to accomplish their functions. For beginners, more errors come from mistyping than from errors of understanding.

Every HTML tag starts with "<", and ends with ">". HTML tags come in pairs, with only a few exceptions.

Paired tags always appear like this: <table> will eventually be followed by </table>, although you may find many other tags between the starting tag and the ending tag for any given pair. Tags that appear within the scope of another tag have a parent-child relationship that can be exploited in CSS. Not only can you apply styling to a DIV (box) and to a paragraph, you can also apply styling to paragraphs that occur inside certain DIVs – this is a very powerful technique.

These HTML tags do not require an ending tag: br, img, input, link, doctype, and meta. If you are using XHTML instead of HTML, then you will have to self-close the tag with a slash inside the tag, such as with images:

<img href="pretty-picture.jpg" />.

Tags are hierarchically nested. You can easily chart out a page to discover problems with nesting – draw arcs on the printed page to connect pairs of tags. If your arcs overlap, then you have a problem. This is correct:

<strong><em>Example</em></strong>

whereas this is not correctly nested:

<strong><em>Example</strong></em>

Comments in HTML look like this:

<!--This is a terminated (single-line only) comment in an HTML file.-->

Comments inside a CSS style block within an HTML file look like this:

/* This is a terminated comment in a CSS file or a Javascript file. The comment
can span multiple lines. */

DFF’s Canonical HTML/CSS/JS Files

These 3 files provide a good starting point for developing Web pages. The HTML file has all of the common HEAD tags in place, including statements that read in a CSS style sheet (2 versions, where the second can tailor the output for printing) and a Javascript file. It also shows how to define styling and scripts in the HEAD section of the HTML file. The BODY content is just sample code that can be tossed. The style sheet contains several useful things, including: default settings for standard HTML tags (to standardize behavior or appearance) and some debugging classes you may find handy.

How Can You See "Beneath the Covers" of a Page?

CIS86 HomeContact DFFSiteMap • © 2009, Dennis F. Freeze