Re: <br> vs. <p>

Jim Angstadt <jima@gvn.net> wrote:

> Tidy modifies the following code samples:

Apparently XML or XHTML.

> <br clear=all>         or

In XML, attribute values must be quoted, and empty tags end with />

> <br clear="all" />     or

That one is the same as your output.  No change.

> <br clear="all"></br>

The br tag is not a container, so can't have a </br>.

> to the following:
>
> <br clear="all" />

Reasonable.

> on my Windows 98 box, while reporting:
>
> Tidy (vers 13th January 2000) Parsing "snow.html"
> line 20 column 6 - Warning: trimming empty <p>

Maybe, under XML, Tidy doesn't like a <br> outside a <p>.  Seems a strange
error message though if that were the case.  Also, it would complain about
the <a> not having a container.

If you could cite a URL to the full page that exhibits the behavior it
would be much easier to diagnose.

> Re-running Tidy results in the same warning message for each instance of
> the Tidied br element.
>
> Question 1.  Why does Tidy report an empty <p> and not an empty <br>?

Because <br>s are always empty; they aren't containers.

> Question 2.  Is there a better, or more preferred, way to do this?

Working from your example markup, try putting the <br clear="all" /> as the
last content your last paragraph?  Further, put the <a>...</a> as the first
content of your first paragraph.
-- 
         ,=<#)-=#  <http://www.war-of-the-worlds.org/>
    ,_--//--_,
 _-~_-(####)-_~-_  "Did you see that Parkins boy's body in the tunnels?" "Just
(#>_--'~--~`--_<#)  the photos.  Worst thing I've ever seen; kid had no face."

Received on Friday, 17 March 2000 16:40:55 UTC