Re: Understanding Tidy

	I find it confusing when Tidy tells me I cannot use (leaving out details):
	
	<FONT>
		<UL>
			<LI>
			<LI>
		</UL>
		<P>Whatever
	</FONT>
	
Roughly speaking, HTML elements fall into two groups.
"Block" and "inline".  <UL> is a block element.  <FONT> is inline.
This has always been a basic fact about HTML.  *All* text style
elements are inline.  So what's confusing?

	Tidy wants to see a </FONT> before the <UL>.
	Is SGML/HTML really that restrictive?

SGML is not.  HTML is.

	If so, I'd like to see the specs for this?
	
http://www.w3c.org/TR/html4/sgml/loosedtd.html

    <!ELEMENT FONT - - (%inline;)*>

This says that the start and end tags of FONT are required,
and that it may only contain the elements listed in %inline, which is

    <!ENTITY % inline "#PCDATA|%fontstyle;|%phrase;|%special;|%formctrl;">

which turns out to mean
    #PCDATA|
    TT|I|B|U|S|STRIKE|BIG|SMALL|
    EM|STRING|DFN|CODE|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|
    A|IMG|APPLET|OBJECT|FONT|BASEBONT|BR|SCRIPT|MAP|Q|SUB|SUP|SPAN|BDO|IFRAME|
    INPUT|SELECT|TEXTAREA|LABEL|BUTTON

Any good book on HTML will make this clear.

	In order to understand Tidy, it would help to learn where is the formal 
	specification on how tags can be nested.
	
	Is this info in the HTML 4 spec? I cannot seem to find the info.

Yes of course.  The HTML 4 specification not only explains *that* the
definition is in the DTDs, and *where* the DTDs are in the spec, but
*how* to read them.

	Or do I have to look at the SGML Handbook to learn SGML's rules?
	
It has nothing to do with SGML.	SGML provides the general framework in which
you can define a set of tags and their attributes and containment and ordering
relationships, but does not provide any tags of its own.  FONT is described a
little bit better in the HTML 3.2 spec, because in HTML 4 you're really not
supposed to use it at all.

In HTML 4, you are expected to use cascading style sheets, and you *can*
write
    <UL STYLE="font: ..."> ... </UL>
using CSS.

Received on Sunday, 10 December 2000 19:33:08 UTC