Re: Why no <IMG> inside <PRE>?

Rainer Klute wrote:
-> 
-> >A shorter kludge is <pre><tt><img></tt></pre>.
-> 
-> No, sorry. Since in the PRE element declaration IMG occurs as an
-> exception, it is not permitted anywhere down in the element
-> hierarchy inside a PRE element.
-> 

That's not true in HTML2. The DTD only lists:

<!ENTITY % pre.content "#PCDATA | A | HR | BR | %font | %phrase">
<!ENTITY % pre.content "#PCDATA | A | HR | BR">
<!ELEMENT PRE - - (%pre.content)*>

Why there are two definitions of pre.content I have no idea, though it seems
the first one should be the correct one -- I want <b> and <i> in <pre> for
example. (Oh, I could have said that <pre><i><img></i></pre> was an even
shorter kludge, but it can mess up the interline spacing on Netscape even
when the image is only 1 pixel high, so I prefer to use two extra characters).

The (now expired) March '95 HTML3 draft DTD listed IMG as a pre.exclusion
so what I wrote would not be valid under that DTD (despite the claim that
"HTML 3.0 builds upon HTML 2.0 and provides full backwards compatibility").
Something like FIG might have worked instead under HTML3 though.

-- 
Stephen R. E. Turner
  Stochastic Networks Group, Statistical Laboratory, University of Cambridge
  e-mail: sret1@cam.ac.uk  WWW: http://www.statslab.cam.ac.uk/~sret1/home.html

Received on Wednesday, 10 January 1996 05:51:39 UTC