Re: Proper HTML Tag Placement

In article <CunMn4.65K@unixhub.SLAC.Stanford.EDU>,
Mike Kelsey <kelsey@avocet.SLAC.Stanford.EDU> wrote:

>|> >   <a href="..."><h1>...</h1></a>
>|> >or
>|> >   <h1><a href="...">...</a></h1>
>|> 
>|> >Why is one method preferable to the other?

>From Mosaic, pull down [Help], select [On HTML...], and you will be in
><http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html>.  From
>the contents section, under Troubleshooting select "Embed Anchors and
>Character Tags, But Not Anything Else", and you will be moved to
><http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html#A1.8.2>.
>I quote this section in full, since this is where I got the information
>for my original post:
>
>----------------------
>
>Embed Anchors and Character Tags, But Nothing Else
>
>It is acceptable to embed anchors within another HTML element: 
>
>    <H1><A HREF = "Destination.html">My heading</A></H1>
>
>Do not embed a heading or another HTML element within an anchor: 
>
>    <A HREF = "Destination.html">
>    <H1>My heading</H1>
>    </A>
>
>Although most browsers currently handle this example, it is forbidden
>by the official HTML and HTML+ specifications, and will not work with
>future browsers.

According to the HTML 2.0 DTD, the second item is legal, but the DTD is
setup that the second item will could become illegal in future
versions.  I believe it is currently set up to be more backward
compatible than enforcing the newer style.

My minor grievance about the possible future usability of the anchor
element is that STRONG and EM elements will not be allowed in an
anchor.  For example:

	<H2><A NAME="foo">The <CODE>FOO</CODE> command</A></H2>

seems fine for me on a stylistic point of view, but will be illegal.
The future content model of the anchor is supposed to be the
following:

	(#PCDATA | IMG | BR)+  -(A)


I figure if you are going to allow #PCDATA as part of the content
of an anchor, then the character based style elements should also
be allowed.

	--ewh

Received on Wednesday, 17 August 1994 17:39:50 UTC