Re: A problem w/PRE element

eva (eva@algonet.se)
Mon, 22 Sep 1997 08:41:07 +0200


Message-Id: <199709220641.CAA14921@www10.w3.org>
From: "eva" <eva@algonet.se>
To: <www-html@w3.org>, "Jordan Reiter" <jreiter@mail.slc.edu>
Date: Mon, 22 Sep 1997 08:41:07 +0200
Subject: Re: A problem w/PRE element

 Jordan Reiter <jreiter@mail.slc.edu>



>I was validating a page using the Kindler, Gentler Validator (DOCTYPE HTML
>4.0) and was told that my use of the PRE element was incorrect because
>   : document type does not allow element "PRE" here; missing one of
>   : "OBJECT", "IFRAME", "BUTTON" start-tag
>I looked through the docs and found no reference to PRE being required to
>be within OBJECT, IFRAME or BUTTON elements.  What is wrong here?

><P ALIGN=CENTER><SMALL><PRE>
>foo
>   foo
>      foo
></PRE></SMALL></P>

The above doesn't validate as PRE (block) is not allowed in SMALL (inline)

OBJECT, IFRAME, BUTTON are all inline elements and as such allowed in SMALL.
All three, however, can contain blocklevel elements:

<!ELEMENT IFRAME - - (%block;)+ -- inline subwindow -->
<!ELEMENT OBJECT - - (PARAM | %inline; | %blocklevel;)* -- generic embedded
object -->
<!ELEMENT BUTTON - -     (%inline; | %blocklevel;)+ -(A | %formctrl; | FORM
| ISINDEX | FIELDSET)     -- push button -->

Therefore (e.g.)
<P ALIGN=CENTER><SMALL><IFRAME><PRE>
foo</PRE></IFRAME></SMALL></P>
is valid

/e