Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

about <ul>

0 views
Skip to first unread message

pipehappy

unread,
Oct 9, 2006, 4:44:49 PM10/9/06
to
Hi

I search around and find there are many discussion about
<ul><li><p>something</p></li></ul>. But I cannot find solution to <ul>
itself. I pass the following html through validate.w3.org. and it
always report error of misuse of <ul>. Could someone tell me the
solution to this problem? Thanks!

-----------------------------
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
<title>some</title>
</head>

<body>

<p>some
<ul>
<li><p>structured network components</p></li>
</ul>
</p>

</body>
</html>

Els

unread,
Oct 9, 2006, 4:57:50 PM10/9/06
to
pipehappy wrote:

> Hi
>
> I search around and find there are many discussion about
> <ul><li><p>something</p></li></ul>. But I cannot find solution to <ul>
> itself. I pass the following html through validate.w3.org. and it
> always report error of misuse of <ul>. Could someone tell me the
> solution to this problem? Thanks!

> <p>some


> <ul>
> <li><p>structured network components</p></li>
> </ul>
> </p>

You can't have a <ul> inside a <p>.

Try this:

<p>some</p>


<ul>
<li><p>structured network components</p></li>
</ul>

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/

prac

unread,
Oct 9, 2006, 5:05:38 PM10/9/06
to
Hello,
<p> is a block tag. And inside a block tag you cannot put a list !!

simply change like this, it will be "This Page Is Tentatively Valid
XHTML 1.0 Strict"
(message of w3c validator)

<body>
<p>some</p>


<ul>
<li><p>structured network components</p></li>
</ul>

</body>

I hope this help you

---------------------
http://philippe.chappuis.googlepages.com
---------------------

Els

unread,
Oct 9, 2006, 5:19:15 PM10/9/06
to
prac wrote:

> Hello,
> <p> is a block tag. And inside a block tag you cannot put a list !!

<div> is a block element. And inside <div> I can certainly put a list.
You can't have a list inside a paragraph, but that's not because <p>
is a block element.

David Dorward

unread,
Oct 10, 2006, 3:22:53 AM10/10/06
to
prac wrote:

> <p> is a block tag. And inside a block tag you cannot put a list !!

Wrong. The <p> element is defined as only being able to contain inline
elements, which is why it cannot contain lists (since they are block
elements). Most block elements can contain other block elements.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

Andy Dingley

unread,
Oct 10, 2006, 7:32:56 AM10/10/06
to

prac wrote:

> <p> is a block tag. And inside a block tag you cannot put a list !!

"It's a block tag" is too simple an explanation of what's going wrong
here.

There are no "block tags" in HTML. There are elements that can (or
cannot) contain "block" elements, and there are elements that may (or
may not) behave as "block" elements. However the "inside and outside"
behaviour is independent. For some elements like <span> or <div>
they're the same - they both can contain the same thing as they
themselves are. For <p> though it behaves like a "block" element when
you're using it, but it can't itself _contain_ other "block" elements.
You can nest <div>s and you can nest <span>s, but you can't nesst <p>s.

Jobe

unread,
Oct 10, 2006, 12:25:49 PM10/10/06
to
Andy wrote:

>You can nest <div>s and you can nest <span>s, but you can't nesst <p>s.

We all understand what the initial problem is, and what the solution
is.
However sometimes words and expressions are used to explain and help,
which can be stuff for a new discussion:)

Andy stated that "you can't nest <p>'s.

Is the code below an example of nesting? If so...<p>'s can be nested :)


<head>
<style type="text/css">
.p1 {color:red;}
.p2 {color:green;}
</style>
</head>

<body>
<p class="p1">Something
<p class="p2">else</p></p>
</body>

Michael Stemper

unread,
Oct 10, 2006, 1:01:40 PM10/10/06
to
In article <1160497549.7...@e3g2000cwe.googlegroups.com>, Jobe writes:
>Andy wrote:

>>You can nest <div>s and you can nest <span>s, but you can't nesst <p>s.
>
>We all understand what the initial problem is, and what the solution
>is.
>However sometimes words and expressions are used to explain and help,
>which can be stuff for a new discussion:)
>
>Andy stated that "you can't nest <p>'s.
>
>Is the code below an example of nesting? If so...<p>'s can be nested :)

><body>


><p class="p1">Something
><p class="p2">else</p></p>
></body>

When the second paragraph begins, the first one is automatcially ended.
So, the second paragraph is not "nested" in the first one.

Later on, there is a superfluous tag, which will give a validation error.

--
Michael F. Stemper
The FAQ for rec.arts.sf.written is at:
http://www.geocities.com/evelynleeper/sf-written
Please read it before posting.

Harlan Messinger

unread,
Oct 10, 2006, 2:40:23 PM10/10/06
to
Jobe wrote:
> Andy stated that "you can't nest <p>'s.
>
> Is the code below an example of nesting? If so...<p>'s can be nested :)
>
> <head>
> <style type="text/css">
> .p1 {color:red;}
> .p2 {color:green;}
> </style>
> </head>
>
> <body>
> <p class="p1">Something
> <p class="p2">else</p></p>
> </body>

It's an example of nesting Ps and as such it's invalid. Where the
validator will discover this is when it reaches the second </p>. It
won't discover it at the second <p> because the closing tag for a P is
optional, so the validator will impute a closing tag just before the
second opening tag because the first P element can't be closed any later
than that.

VK

unread,
Oct 10, 2006, 2:48:15 PM10/10/06
to

Andy Dingley wrote:
> There are no "block tags" in HTML. There are elements that can (or
> cannot) contain "block" elements, and there are elements that may (or
> may not) behave as "block" elements. However the "inside and outside"
> behaviour is independent. For some elements like <span> or <div>
> they're the same - they both can contain the same thing as they
> themselves are. For <p> though it behaves like a "block" element when
> you're using it, but it can't itself _contain_ other "block" elements.
> You can nest <div>s and you can nest <span>s, but you can't nesst <p>s.

Is not the OP's problem was with:
...


<li><p>structured network components</p></li>

...
? I did not go to the Validator, so not sure at all, but that seems the
only anyhow questionnable construct.

In application to P tag it is a fancy matter, because originally the
Man did it as *paragraph break*, so there were line break BR and
paragraph break P (without closing tag in both cases). I said "there
were" but actually they still are. This did not prevent the Man to
become Sir :-) but W3C had a very hard time later to describe P in
terms of a block element with closing tag and at the same time to make
sure that a standard-compliant UA will not break on legacy pages where
P is nothing but "big BR". That is why by the amount of notes, mentions
and clarifications P has all times leadership among HTML tags in W3C
papers.

The final compromise was that P is a block element with closing tag but
it automatically ends up (closes up) before any other block element.
That is of course a weird behavior but seems as an overall smart
decision given that they had to incorporate cases like
Paragraph 1
<p>
Paragraph 2
<p>
Paragraph 3
(a legacy page with "paragraph breaks")

and

<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
(current style)

Harlan Messinger

unread,
Oct 10, 2006, 3:10:54 PM10/10/06
to
VK wrote:
> Andy Dingley wrote:
>> There are no "block tags" in HTML. There are elements that can (or
>> cannot) contain "block" elements, and there are elements that may (or
>> may not) behave as "block" elements. However the "inside and outside"
>> behaviour is independent. For some elements like <span> or <div>
>> they're the same - they both can contain the same thing as they
>> themselves are. For <p> though it behaves like a "block" element when
>> you're using it, but it can't itself _contain_ other "block" elements.
>> You can nest <div>s and you can nest <span>s, but you can't nesst <p>s.
>
> Is not the OP's problem was with:
> ...
> <li><p>structured network components</p></li>

There isn't anything wrong with that. The problem was the UL nested
inside the P.

VK

unread,
Oct 10, 2006, 3:29:46 PM10/10/06
to
> > Is not the OP's problem was with:
> > ...
> > <li><p>structured network components</p></li>
>
> There isn't anything wrong with that. The problem was the UL nested
> inside the P.

Then they maybe changed DTD for XHTML in application to P. By HTML
specs UL physically cannot be nested inside P: P block will be
automatically ended before opening UL tag, and after UL block we are
getting unmatched closing /P tag. Is unmatched *closing* tag breaks
well-formedness? If so, then it can be the answer.

Harlan Messinger

unread,
Oct 10, 2006, 3:37:57 PM10/10/06
to
VK wrote:
>>> Is not the OP's problem was with:
>>> ...
>>> <li><p>structured network components</p></li>
>> There isn't anything wrong with that. The problem was the UL nested
>> inside the P.
>
> Then they maybe changed DTD for XHTML in application to P.

???

> By HTML
> specs UL physically cannot be nested inside P: P block will be
> automatically ended before opening UL tag, and after UL block we are
> getting unmatched closing /P tag.

Yes, Els, told the OP that 23 hours ago.

> Is unmatched *closing* tag breaks
> well-formedness? If so, then it can be the answer.

It *was* the answer.

VK

unread,
Oct 10, 2006, 3:48:14 PM10/10/06
to

Harlan Messinger wrote:
> > Is unmatched *closing* tag breaks
> > well-formedness? If so, then it can be the answer.
>
> It *was* the answer.

I really missed that post, so the above was my own guess. I'm glad it
was right - even if not needed anymore.

0 new messages