Re: colours for bullets - this one is simple, works, & addresses

Gordon Blackstock wrote:
> > From: Liam Quinn
> >....
> > This is invalid code.  You cannot have text within an OL outside of

> > a LI.  You can't predict what a browser will do with invalid code.

> After reading and re-reading the HTML 3.2 section on ordered lists I
can
> find nothing which indicates that closing an LI element is invalid;
it's
> optional, but not invalid. The general statement on lists allows for
both
> block and text level items; only headings and addresses are excluded.

I believe the proscription is in the DTD fragments "<!ELEMENT OL - - 
(LI)+>" and "<!ELEMENT UL - -  (LI)+>". Regardless of what the text
says, the SGML declaration indicates that only LI elements are allowed
as content within the OL and UL elements.

If text outside of the LI element were OK, would MSIE's rendering of
your example be correct? The spec reads: "Most elements that can appear
in the document body fall into one of two groups: block level elements
which cause paragraph breaks, and text level elements which don't."

The list item is block level. So how should the following markup be
displayed?

  <DIV>Here's a division
  <P>Here's some paragraph text
  <UL>Here's illegal text
  <LI>here's item one</LI>
  <LI>here's item two</LI>
  more illegal text
  </UL>
  Here's the end of the paragraph
  </P>
  And here's the end of the division
  </DIV>

In the case where 'legal' text follows "</P>" and "</DIV>", both IE3
and N3 render the text on a new line, as expected. But IE renders the
list element following the first 'illegal' text on the same line as the
text. N begins the list element on a new line, but both IE and N render
the second illegal text on the same line as the preceding list element.
It's this contrary behavior that is allowing your example to work.

Methinks it's safer to color the UL and OL to get colored markers and
SPAN the text within the LI to color the list item text.

David Perrell

Received on Tuesday, 15 April 1997 05:34:31 UTC