This section is going to be straight definitions and examples; it should be used as a reference and study guide.
This diagram also permits a clear, mechanical definition of "cross-nesting" tags, which must be avoided:
- Scan through the HTML and find a tag with a slash.
- Scan back from there to find the immediate previous tag of the same keyword.
- Draw lines in the left margin, connecting the start and stop tags of that pair. (If the tags are both embedded in the same line of text, then draw the pairing lines underneath.)
- Go back to step 1 unless all the paired-type tags in that block of HTML have been marked.
If you can draw the pairing lines such that none of the lines cross, you have properly nested your tags. If there is anywhere that the lines must cross, most browsers will object in one way or another, often rendering the page in unpredictable ways.
While viewing the source, follow the instructions to begin constructing your own exercise file. We will discuss the tags inside the BODY as this class progresses.
These tags all go into the BODY section, and are the real meat and guts of your HTML document. We will discuss each of them in detail. Anchors get a section of their own (later), because they are so important.
There are three main separators used to break up blocks of text in an HTML document:
The break tag
is
used
to
break
up
lines
of
text. It does much the same thing in HTML that a "Hard Return" does in a word processor.
Multiple <BR> tags in a row do increase the white space in the display.
Horizontal rules are better choices for separating sections of your document than are wide short graphic images, because they will display correctly on any screen and with any browser.
While viewing the source, look for the separator tags inside the Body section, and observe their effects on the displayed page.
The conventional, but not required, use of this anchor tag is to place the E-mail address between the <A HREF=...> and the </A> tags, to serve as the visible, clickable text of the link. Any visible text or graphic image will serve. The advantage of using simply the E-mail address itself is that it will be printed.
While viewing the source, look for the mailto anchor tag near the end of the Body section, and observe the effect on the displayed page. Review the entire page; are there any tags whose meaning and effects you do not understand?
Each image tag should include four important attributes: SRC, WIDTH, HEIGHT, and ALT. In general, "attributes" are adjectives, adverbs, or objects of the basic tag verb, and are found inside the angle brackets, as shown below. The order of the attributes does not matter, but the primary tag keyword must come first. We will be discussing attributes in more detail in HTML II.
Including the WIDTH and HEIGHT will speed up the display of your page, because the browser does not have to wait for the image data file to arrive in order to know those values and so be able to continue laying out the text and other images onto the screen.
The SRC element is usually a relative URL (more on that in the anchor section), but can be a full URL. If you use full URL's of an image that exists on another server, you may well make the owner of that server angry, so don't do it without asking permission.
While viewing this page, right-click on the graphic image (Windows) or click and hold the click until the menu pops up (Macintosh), then choose to save the image. Place it on your floppy disk, into the "NEWHTML" folder, into the "pagemasters" folder, into the "class" folder, into the "gifs" folder.
While viewing the source, look for the image tag near the top of the Body section, and observe the effect on the displayed page. Review the entire page; are there any tags whose meaning and effects you do not understand?
The present standard for HTML includes 6 levels of headings, denoted by:
As you can see, above, header levels 5 and 6 are displayed with a type face smaller than the main body text. Even though they are bold, they will be hard to read, because most people configure Netscape to display main body text as small as they can easily read, in order to fit as much as possible on the screen. Therefore it is usually a bad idea to use header levels 5 or 6. If you are viewing your pages on a Windows machine, please be aware that any given text will be displayed significantly smaller on-screen for most Macintosh users, exaggerating this problem for that part of your audience.
While viewing the source, look for the header tags in the Body section, and observe their effects on the displayed page. Review the entire page; are there any tags whose meaning and effects you do not understand?
There are three main types of lists:
Each separate list item begins with an <LI> tag. There is no </LI> tag.
<OL> <LI>List item number one. <LI>List item number two. <LI>List item number three. Notice how the text on this list item will wrap around to form a hanging indent, and not be given a new number, even though it is wider than one screen-width (at least for people with reasonable-sized screens). <LI>List item number four. </OL>
produces this display:
Each separate list item begins with an <LI> tag. There is no </LI> tag.
<UL> <LI>List item number one. <LI>List item number two. <LI>List item number three. Notice how the text on this list item will wrap around and not be given a new number, even though it is wider than one screen-width (at least for people with reasonable-sized screens). <LI>List item number four. </UL>
produces this diplay:
The graphic characters chosen for the bullets at each level of indentation will depend on the browser. Lynx uses *, +, and -, while Netscape uses solid circles, hollow circles, and hollow squares.
Lists that are unbulleted are surrounded by <DL> and </DL> tags. (Think of them as "Definition Lists," they do work well for a glossary.)
Each entry in a definition list has a two parts, the defined term and the defining data.
<DL> <DT>Definition list <DD>An HTML list structure that works well for a glossary and for the overall structure of a home page. <P> <DT>Defined Term <DD>The Defined Term is preceded by a <DT> tag and appears flush to the current left margin. <P> <DT>Defining Data <DD>The Defining Data is preceded by a <DD> tag and appears indented one step from the current left margin. </DL>
produces this display:
It is possible to nest lists and use other tricks to get nicely formatted output. We will discuss list nesting and other techniques in HTML II.
While viewing the source, look for the list tags in the Body section, and observe their effects on the displayed page. Review the entire page; are there any tags whose meaning and effects you do not understand? We will discuss the &...; constructs (e.g., ">") later.
While viewing the source, look for the list tags in the Body section, and observe their effects on the displayed page. Review the entire page; are there any tags whose meaning and effects you do not understand? We will discuss the &...; constructs (e.g., ">") later.
Example 5 shows the use of a Definition List as the overall structure of the entire body section (except for the header image at the start and the boilerplate text at the end). This makes the headers stand out and reinforces the overall outline structure of the document by indenting each level of content one step from its headers. If a given Web page has only a few levels of headers, this may well be a sensible design.
Another good way to get a feel for these lists is to study the list examples.
This is strong text
This is italicized text
While viewing the source, look for the STRONG tags in the Body section, and observe their effects on the displayed page. Review the entire page; are there any tags whose meaning and effects you do not understand? We will discuss the &...; constructs (e.g., ">") later.
Dick Piccard revised this file (http://www.ohiou.edu/pagemasters/class/html1/tags.html) on January 2, 2002.
Please E-mail any comments or suggestions to acatec@www.ohiou.edu.