HTML Cookbook Basic HTML Course

It's Easy!

Alternate version

Document Structure and the Box Model

Let's talk about a concept that will help us understand page hierarchy and which tags can be used where. This is part of understanding the "well-formed page" rule. Most of this will be review, but we will also about "block-level" elements vs. "inline" elements. An element is just a tag.

First, think of your page as a big box that has other boxes in it.
<html>...</html> is a "box".

We already know that all pages should have 2 (and only 2) sections, the head and the body.
<head>...</head>
and
<body>...</body>
are boxes in the 'html' box.

We also know the 'head' box must have a 'title' box, so you must have

<head>
<title>
...
</title>
</head>

But you can't put the head in the title, so you may not have

<title>
<head>
...
</head>
</title>

Now let's talk about elements.

An element is basically just a tag, but it includes the concept about what it might contain.

There are "block-level" elements and "inline" (or "text-level") elements.

Block-level elements are boxes that may contain inline elements or other block-level elements. They usually start a new line. According to the W3C, they "create larger structures than inline elements".

Some block-level element examples:
div
p
pre
h1
hr
blockquote
table
ol
ul
dl

"Inline" elements are items that may go in block-level elements. They may also contain other inline elements.

Some inline element examples:
a
img
span
em
cite
font
i
b
u

For further review and lists of block-level and inline elements, you can visit:
WDG: HTML 4.0 Block-Level Elements
WDG: HTML 4.0 Inline Elements
W3C: Block-Level and Inline Elements
Web Geek: HTML 4.0 Block-Level Elements

Happy coding!
Gnubee

Links
Tips
Tools
References
Rules
HTML Help Gnubee - Newsgroup
HTML Course Contents (Home)

Valid XHTML 1.0!

Valid CSS!