Myreader.co.uk  
uk news, chat and community
   home   |   control panel login   |   archive   |  
 
net
net
news.announce
news.config
news.management
news.moderation
providers
providers.aaisp
web.authoring
  
 
date: Wed, 30 Apr 2008 12:46:18 +0100,    group: uk.net.web.authoring        back       
<div>s within lists   
What is allowed immediately inside a block-level list element?

For example, is:

<ul>
        <div>
                <li></li>
                <li></li>
                <li></li>
        </div>
        <div>
                <li></li>
                <li></li>
                <li></li>
        </div>
</ul>

valid (i.e. are the <div>s, allowed there)?

I presume not, but I couldn't find a declaration in the specifications
to the effect: you shall not have any elements directly inside a <ul>
other than a <li>.

Daniele
date: Wed, 30 Apr 2008 12:46:18 +0100   author:   (D.M. Procida)

Re: <div>s within lists   
On 30 Apr, 12:46, real-not-anti-spam-addr...@apple-juice.co.uk (D.M.
Procida) wrote:
> What is allowed immediately inside a [...] list element?

<!-- Unordered Lists (UL) bullet styles -->
<!ELEMENT UL - - (LI)+                 -- unordered list -->

From http://www.w3.org/TR/html4/sgml/dtd.html

So that's one or more <li>, and no other elements.

Surely you read c.i.w.a.h?
date: Wed, 30 Apr 2008 08:00:57 -0700 (PDT)   author:   Andy Dingley

Re: <div>s within lists   
On Wed, 30 Apr 2008, Andy Dingley wrote:

> <!-- Unordered Lists (UL) bullet styles -->
> <!ELEMENT UL - - (LI)+                 -- unordered list -->
>
> From http://www.w3.org/TR/html4/sgml/dtd.html

Or  http://www.htmlhelp.com/reference/html40/lists/ul.html
which is easier to read.

-- 
In memoriam Alan J. Flavell
http://groups.google.com/groups/search?q=author:Alan.J.Flavell
date: Wed, 30 Apr 2008 17:05:53 +0200   author:   Andreas Prilop

Re: <div>s within lists   
Andreas Prilop wrote:
> On Wed, 30 Apr 2008, Andy Dingley wrote:
> 
>> <!-- Unordered Lists (UL) bullet styles -->
>> <!ELEMENT UL - - (LI)+                 -- unordered list -->
>>
>> From http://www.w3.org/TR/html4/sgml/dtd.html
> 
> Or  http://www.htmlhelp.com/reference/html40/lists/ul.html
> which is easier to read.
> 

Surely you can put a <span> in anywhere?  If so, why not a <div>?

Phil, London
date: Wed, 30 Apr 2008 18:29:19 +0100   author:   Philip Herlihy

Re: <div>s within lists   
On Wed, 30 Apr 2008 18:29:19 +0100, Philip Herlihy wrote:

>> 
> Surely you can put a <span> in anywhere?  If so, why not a <div>?

Noooooo you can't! 
In general, you're not allowed to enclose any block element in any inline 
element.
In practice, browsers tend to allow it where the meaning is obvious, but 
of course it's very bad practice to rely on that.

-- 
Anahata
anahata@treewind.co.uk -+- http://www.treewind.co.uk
Home: 01638 720444         Mob: 07976 263827
date: Wed, 30 Apr 2008 13:13:58 -0500   author:   Anahata

Re: <div>s within lists   
Anahata wrote:
> On Wed, 30 Apr 2008 18:29:19 +0100, Philip Herlihy wrote:
> 
>> Surely you can put a <span> in anywhere?  If so, why not a <div>?
> 
> Noooooo you can't! 
> In general, you're not allowed to enclose any block element in any inline 
> element.
> In practice, browsers tend to allow it where the meaning is obvious, but 
> of course it's very bad practice to rely on that.
> 

That makes sense!  Thanks!

But reflecting... aren't <li> items block items?

(If you hide your ignorance you tend to keep it!)

Phil
date: Thu, 01 May 2008 22:01:58 +0100   author:   Philip Herlihy

Re: <div>s within lists   
On Thu, 01 May 2008 22:01:58 +0100, Philip Herlihy wrote:

> 
> But reflecting... aren't <li> items block items?

Yes. What's the problem with that?

In this context, it means you shouldn't say
<span style="xxx">
  <li>
    text
  </li>
</span> 

-- 
Anahata
anahata@treewind.co.uk -+- http://www.treewind.co.uk
Home: 01638 720444         Mob: 07976 263827
date: Fri, 02 May 2008 03:15:15 -0500   author:   Anahata

Re: <div>s within lists   
On 1 May, 22:01, Philip Herlihy  wrote:

> But reflecting... aren't <li> items block items?

There are no simple "block items".

Blockishness is defined separately for both where things can be put,
and what you can put inside them (and also again for CSS defaults). If
you want to understand this, you have to keep these three concepts of
"blockishness" separate.

For that matter, <li> isn't even a block element (meaning that it's a
member of %block; thus can be put in the same places as <div> or <p>).
<li> is special and has a particular symbiotic relationship with <ul>
and <ol>.
date: Fri, 2 May 2008 05:24:50 -0700 (PDT)   author:   Andy Dingley

Google
 
Web myreader.co.uk


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us