Bug in validator.w3.org?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


before i write a bug report, i want to ask, if i don't know a rule for 'p'
and 'div':

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd ">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

complains, that in line 10 "end tag for element "P" which is not open".

Is that right? Is it not allowed to put an div into a p?


Re: Bug in validator.w3.org?

Lorenz Haas wrote:

Quoted text here. Click to load it

That's right. div is a block element, p is only allowed to have inline
elements as childs.

Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de /

Re: Bug in validator.w3.org?

Quoted text here. Click to load it

Ok, thanks.


Re: Bug in validator.w3.org?

Actually, closing a <p> with </p> is usually not necessary.  The
next <p>, block element start, or block element end automatically
closes the prior <p>.  

I close with </p> only if the opening <p> has a class or style
specified and I want to follow with text to which that class or
style does not apply.  Thus, I use </p> in the following situation:

<div class=sideright>
<p class=nostyle>*** Begin Right Sidebar ***</p>
   [single paragraph of sidebar text]
<p class=nostyle>*** End Right Sidebar ***</p>

My sideright class formats a box on the right of the page.  My
nostyle class uses to hide the associated text
unless the viewer has disabled style-sheets.  Even here, the </p>
would not be necessary if my sidebar text began with <p>.  The </p>
for "End Right Sidebar" is quite unnecessary (but harmless) because
of the following </div>; however, this line is copied from the
"Begin Right Sidebar" line with only the "Begin" changed to "End".  


David E. Ross

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

Re: Bug in validator.w3.org?

Quoted text here. Click to load it

Just some advice, you'll find debugging easier if you explicitly close <p>
elements, and if you ever decide to go with XHTML, you will _have_ to close
those P elements.

Adrienne Boswell
Please respond to the group so others can share

Re: Bug in validator.w3.org?

On Tue, 21 Jun 2005, Lorenz Haas wrote:

Quoted text here. Click to load it

Before you write a bug report, please find out what the rules are.  
The software world is already overrun with so-called "bug" reports
from over-eager users, that have to be closed with "working as

Quoted text here. Click to load it

As you don't seem to be able to read a DTD yet (which is certainly
excusable, as long as you're not trying to submit bug reports based on
it), I would recommend the WDG's web site,
http://www.htmlhelp.com/reference/html40 /

and in particular, their "organizational list" of elements:


This shows which elements are legal within which, and, as far as I
know, is accurate i.e based on the rules in the actual DTD.

Quoted text here. Click to load it

The validator understands the DTD.  "Validation" is a formal procedure
based on what's found in the DTD: it gives a clear and unambiguous
yes/no answer.  If it ever gives the wrong answer, then the procedure
cannot be a "validator" in that technical sense.  You can be sure that
any such obvious bugs would have long since been noticed.

Quoted text here. Click to load it

Just so.  Basically only "inline" elements are allowed inside a

Site Timeline