Click here to get back home

the canonical structure of links in lists?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
the canonical structure of links in lists? Forrest 07-26-2005
Get Chitika Premium
Posted by Forrest on July 26, 2005, 4:31 am
Please log in for more thread options


A certain person thinks this format is acceptable:

<ul>
<a href="http://foo.com"><li>Foo</a>
<a href="http://bar.com"><li>Bar</a>
</ul>

This happens to fail to display properly in KHTML, i.e. Konqueror and
probably Safari.

I suggest it should be thus:

<ul>
<li><a href="http://foo.com">Foo</a>
<li><a href="http://bar.com">Bar</a>
</ul>

He disagrees.

Is there any technical reason to prefer the latter to the former?



................................................................
Posted via TITANnews - Uncensored Newsgroups Access
>>>> at http://www.TitanNews.com <<<<
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-


Posted by Philip Ronan on July 26, 2005, 9:55 am
Please log in for more thread options


"Forrest" wrote:

> [Re "<ul><a href="http://foo.com"><li>Foo</a>..."
> vs. "<ul><li><a href="http://foo.com">Foo</a>..."]
>
> Is there any technical reason to prefer the latter to the former?

According to the HTML DTD (document type definition), a UL element can only
contain one or more LI elements, while an LI element can contain a mixture
of block and inline elements (that's what "%flow" represents)

<!ELEMENT UL - - (LI)+ -- unordered list -->
<!ELEMENT LI - O (%flow;)* -- list item -->

So that means the hyperlinks should be *inside* the LI elements (i.e.,
"<li><a>", not "<a><li>" (a closing "</li>" tag is implied).

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/



Posted by Forrest on July 27, 2005, 11:18 am
Please log in for more thread options


Philip Ronan wrote:

> According to the HTML DTD (document type definition), a UL element can only
> contain one or more LI elements

Grazie. I thought that was the case, but didn't grasp the W3C's
techiest pages.



................................................................
Posted via TITANnews - Uncensored Newsgroups Access
>>>> at http://www.TitanNews.com <<<<
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-


Posted by Alan J. Flavell on July 27, 2005, 4:42 pm
Please log in for more thread options


On Wed, 27 Jul 2005, Forrest wrote:

> Philip Ronan wrote:
>
> > According to the HTML DTD (document type definition), a UL element
> > can only contain one or more LI elements
>
> Grazie. I thought that was the case, but didn't grasp the W3C's
> techiest pages.

A formal validator (such as the one at the W3C) easily answers such
questions, whether or not one is able to read a DTD.

And the answer will be more reliable than the typical answer that one
would get from usenet (present company excepted, of course ;-)

best regards

Posted by David Ross on July 26, 2005, 5:13 pm
Please log in for more thread options


Forrest wrote:
>
> A certain person thinks this format is acceptable:
>
> <ul>
> <a href="http://foo.com"><li>Foo</a>
> <a href="http://bar.com"><li>Bar</a>
> </ul>
>
> This happens to fail to display properly in KHTML, i.e. Konqueror and
> probably Safari.
>
> I suggest it should be thus:
>
> <ul>
> <li><a href="http://foo.com">Foo</a>
> <li><a href="http://bar.com">Bar</a>
> </ul>
>
> He disagrees.
>
> Is there any technical reason to prefer the latter to the former?
>

Have this person complete the page. Then have him or her test it
at <URL:http://validator.w3.org/>. This can be done via an upload
of a local file; it doesn't have to be installed on a Web server.

By the way, since Safari uses an HTML engine based on Gecko, any
problem with Safari likely affects Mozilla and Firefox, too.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.

Similar ThreadsPosted
Good practice? Title attributes on lists of links August 13, 2005, 4:04 pm
lists in tables October 9, 2004, 5:43 am
Definition lists March 3, 2008, 9:01 am
Problem with descriptive lists in CSS July 6, 2004, 2:54 am
Markup problem: P and lists September 13, 2007, 1:17 pm
CSS display blocks and select lists in IE July 16, 2004, 9:59 pm
Gracefully degrading expandable lists January 24, 2006, 1:18 am
A rendering problem with left aligned image and lists August 13, 2004, 9:34 am
semantic structure of x/y April 17, 2008, 7:21 pm
Simplicity in HTML structure January 23, 2006, 4:48 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap