Reply to Re: The </li> before a nested list. Why not?

Your name:

Reply:


Posted by Andy Dingley on 04/02/07 08:56

On 31 Mar, 12:29, patrick j <usemywebs...@googlemail.com> wrote:

> I'm wondering about lists with nested lists as one does on a Saturday
> afternoon.

Don't wonder, read the DTD and _know_.

You can't (validly) put anything inside a <ul> (or <ol>) except
<li>. So _anything_ you put in there, text, <p> or another nested
<ul> needs to go inside <li>. Not "adjacent to" or "after" <li>, but
contained wholly inside it.

It's SGML, so closing elements are generally optional. As the parser
"knows" that the only thing allowed inside <ul> is <li>, then it can
assume several things about the document, even if the literal </li>
tags have (correctly and optionally) been omitted.

<ul><li></li><ul>...
is clearly invalid. <ul> just can't be a child of <ul>.

<ul><li></li><li><ul>...</ul></li>
is valid. Containment is satisfied and the things that are children in
the document are permitted to be children by the DTD

<ul><li><li><ul>...</ul><li>...
is also valid. Some </li> are (permissibly) omitted. An SGML parser
can automatically generate a document tree from this that's equivalent
to having parsed the following document:

<ul>
<li></li>
<li>
<ul>...</ul>
</li>
<li>...</li>
</ul>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация