required HTML tags? (was RE: [thelist] Hiring Eye Opener - Web Skills Testing)
Matthew D. Fuller
fullermd at over-yonder.net
Wed Feb 27 18:08:00 CST 2002
On Wed, Feb 27, 2002 at 07:09:56PM -0500 I heard the voice of
Joshua Olson, and lo! it spake thus:
>
> > In the HTML 4.01 Strict DTD[1]:
> >
> > - The HTML element must include a HEAD and a BODY element
> > - The HEAD element must include a TITLE element
> > - The BODY element must include at least one block level element
> >
> > [1] - http://www.w3.org/TR/html4/strict.dtd
>
> But, must ever document contain an HTML element?
Yes, but not explicitly.
>From the DTD:
<!ELEMENT HTML O O (%html.content;) -- document root element -->
so, <html> is optional.
<!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head -->
<!ENTITY % head.content "TITLE & BASE?">
<head> is optional, but must include a %head.content (which requires
<title> and may include <base>)
<!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title -->
<title> is NOT optional, and includes PCDATA (unstructured text)
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
and <body> is optional, but must containt at least one block-level or
<script> element.
So, by that logic, the smallest technically legal HTML doc is:
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title></title>
<p>
---
(the end tag of <p> is optional as well)
<html>, <head>, and <body> are all optional and thus impied by the
structure.
--
Matthew Fuller (MF4839) | fullermd at over-yonder.net
Unix Systems Administrator | fullermd at futuresouth.com
Specializing in FreeBSD | http://www.over-yonder.net/
"The only reason I'm burning my candle at both ends, is because I
haven't figured out how to light the middle yet"
More information about the thelist
mailing list