W3C home > Mailing lists > Public > www-html@w3.org > October 1999

Re: nesting block level elements

From: Nir Dagan <nir@nirdagan.com>
Date: Fri, 22 Oct 1999 18:30:29 -0400
Message-Id: <199910222228.SAA18953@vega.brown.edu>
To: "Alan G. Isaac" <aisaac@american.edu>, www-html@w3.org
At 05:04 PM 10/22/99 -0400, Alan G. Isaac wrote:
>Is it correct that HTML 4 forbids
>nesting other block level elements
>in a P element?

Yes. Also HTML2.0 and HTML3.2, for that matter.

>How then is one supposed to markup
>a paragraph containing several lines
>of computer code? 
>The obvious coding would be to have a
>PRE element nested in the P element.
>(The phrase element CODE is not useful 
>for this, even if it might be in some 
>perverse sense correct.)

If preserving white space is important, then PRE 
is the only practical option, but it can't be in a <p>.

CSS has a white-space property (chapter 16.6 in CCS2 
http://www.w3.org/TR/REC-CSS2/text.html#white-space-prop ), 
but it applies only to block level elements, so you're out of luck 
if you want to apply it to inline content. 

>If this question is not list-appropriate,
>can someone please point me to an 
>enlightening discussion elsewhere.
>Thank you,
>Alan Isaac
>PS A similar question arises in the context
>of math displays, if these will be block
>level (will they?), since these are often 
>an integral part of a paragraph.

HTML is not designed for math. One can use MathML 
to display mathematical expressions inline in an XML document.

In principle one can embed MathML inline in HTML documents
using <object>, 
but there isn't much support in browsers right now (you'll need plugins to 
actually see the math). Also you can use <IMG> inline, but this 
means that you display the math using images, not MathML.
The latter seems the only practical method nowadays, unless you 
are willing to use PDF.

Nir Dagan
Assistant Professor of Economics
Brown University 
Providence, RI

Received on Friday, 22 October 1999 18:28:42 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:51 UTC