What this piece of code doesn't validate?

K

kosanovic

Hello, Can somebody please tell me what to do to make this validate?
The error is "end tag for element "P" which is not open."

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type"content="text/html;charset=iso-8859-1">
<meta name="Description" content="Software shareware">
<title> test layout </title>
</head>
<body>
<P class="title">BLABLA
<UL>
<LI><A href="contact.htm">Contact Us</A>
</UL>
</P>
</body>
</html>
 
C

Chris F.A. Johnson

Hello, Can somebody please tell me what to do to make this validate?
The error is "end tag for element "P" which is not open."

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type"content="text/html;charset=iso-8859-1">
<meta name="Description" content="Software shareware">
<title> test layout </title>
</head>
<body>
<P class="title">BLABLA
<UL>

The paragraph is implicitly ended (remember, the end tag is not
 
B

Beauregard T. Shagnasty

Hello, Can somebody please tell me what to do to make this validate?
The error is "end tag for element "P" which is not open."

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type"content="text/html;charset=iso-8859-1">
<meta name="Description" content="Software shareware">
<title> test layout </title>
</head>
<body>
<P class="title">BLABLA
<UL>

<LI><A href="contact.htm">Contact Us</A>
</UL>
</P>

</body>
</html>
 
D

dorayme

Hello, Can somebody please tell me what to do to make this validate?
The error is "end tag for element "P" which is not open."

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type"content="text/html;charset=iso-8859-1">
<meta name="Description" content="Software shareware">
<title> test layout </title>
</head>
<body>
<P class="title">BLABLA
<UL>
<LI><A href="contact.htm">Contact Us</A>
</UL>
</P>
</body>
</html>

Don't put a ul inside a p. What are you doing? What paragraph are
you writing? What things do you want to list? (You maybe like the
bullet too much? ...and are thinking, I need this list to get it?)
 
R

richard

Hello, Can somebody please tell me what to do to make this validate?
The error is "end tag for element "P" which is not open."

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type"content="text/html;charset=iso-8859-1">
<meta name="Description" content="Software shareware">
<title> test layout </title>
</head>
<body>
<P class="title">BLABLA
<UL>
<LI><A href="contact.htm">Contact Us</A>
</UL>
</P><<<----------------------remove
</body>
</html>

Remove the end tag and see what happens.
This is what made M$ FP such a disaster. It added tags where they weren't
needed or wanted.
 
G

Ganesh

Hello, Can somebody please tell me what to do to make this validate?
The error is "end tag for element "P" which is not open."

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type"content="text/html;charset=iso-8859-1">
<meta name="Description" content="Software shareware">
<title> test layout </title>
</head>
<body>
<P class="title">BLABLA
</P>
<UL>
<LI><A href="contact.htm">Contact Us</A>
</body>
</html>

It has to go this way. You cannot use <ul> inside <p> as UL is a block
level element

Ganesh
 
R

richard

Has it ever considered to you that a <p> is not required to have a
corresponding </p>
I ran it through the validator without it and guess what? It validated.
FP was notorious for this inclusion which is why it sucked so bad.
 
R

richard

Why is it that one can not see the forest through the trees?
Have we forgotten the bare basics?
 
K

kosanovic

I would like to thank everybody for comments. I've managed to make a
version that validates in the meantime, but I've learned more from your
comments - thanks.
Logicaly I would never figure out because to me it makes a perfect
sense that in your paragraph you might have a list. And the w3c
Validator has given me the misleading error message (I could say it is
a bug, usually they even say fine suggestions in the error message).

By the way, no, I didn't put the list because of the bullet sign I
actually removed the bullet sign in CSS. I just wanted to list some
things and I thought it would be best to describe it as a list.
 
D

dorayme

I would like to thank everybody for comments. I've managed to make a
version that validates in the meantime, but I've learned more from your
comments - thanks.
Logicaly I would never figure out because to me it makes a perfect
sense that in your paragraph you might have a list. And the w3c
Validator has given me the misleading error message (I could say it is
a bug, usually they even say fine suggestions in the error message).

CSS is often counter-intuitive but on this particular point, are
you sure? Look at some books and mags and you will, of course,
see many paragraphs. In some, there will be lists, graphs and
pics. But - unless you count an inline list that flows along with
the text, even comma separated, you won't see many paras with
"down the page" lists inside them. For the reason, I suppose,
that when the list stops and the text begins after the list, that
text counts as a new para. Yes, I can see if the "after the list"
text is not indented and the text before form a whole "thought",
the issue is then blurred and you might call the whole a para.
But this is rare. And you case seemed not of this type.
By the way, no, I didn't put the list because of the bullet sign I
actually removed the bullet sign in CSS. I just wanted to list some
things and I thought it would be best to describe it as a list.

It was hard to know especially because you had just one item in
your example. Don't be coy about explaining and putting in more
context when posting!
 
J

John Dunlop

(e-mail address removed):
Logicaly I would never figure out because to me it makes a perfect
sense that in your paragraph you might have a list.

I would agree.
And the w3c Validator has given me the misleading error message
(I could say it is a bug, usually they even say fine suggestions in
the error message).

I don't find the error message misleading. P's content model in the
DTD you are validating against does not permit ULs, so the UL
implicitly ends the paragraph, leaving a P end-tag with no
corresponding paragraph. That is an error in your markup, not a bug in
the validator.
By the way, no, I didn't put the list because of the bullet sign I
actually removed the bullet sign in CSS. I just wanted to list some
things and I thought it would be best to describe it as a list.

I would agree, but HTML offers no way to do that.

Visually, you could style paragraphs with a text-indent and style
paragraphs that should, structurally, be continuations of the previous
paragraph with no indent. For example,

<P>foo</P>
<UL>
<LI>item 1</LI>
<LI>item 2</LI>
</UL>
<P class="continue">bar</P>

with the following rule sets:

P { text-indent: 3em }
P.continue { text-indent: 0 }

More extreme, you could modify the DTD to allow ULs inside Ps. You
could then of course no longer truthfully claim conformance to HTML
since you would strictly speaking be using a proprietary markup
notation, although still serving your documents as text/html probably
isn't a cardinal sin.
 
J

Jonathan N. Little

John Dunlop wrote:

Visually, you could style paragraphs with a text-indent and style
paragraphs that should, structurally, be continuations of the previous
paragraph with no indent. For example,

<P>foo</P>
<UL>
<LI>item 1</LI>
<LI>item 2</LI>
</UL>
<P class="continue">bar</P>

with the following rule sets:

P { text-indent: 3em }
P.continue { text-indent: 0 }

Of course *if* IE would only support adjacent sibling selectors the
class "continue" would be unnecessary!


P { text-indent: 3em }
UL + P { text-indent: 0 }


<P>foo</P>
<UL>
<LI>item 1</LI>
<LI>item 2</LI>
</UL>
<P>bar</P>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top