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

Threaded View

This seems too simple by I can't find the answer.

Must <a name="foo">  be closed with </a> ?
Must it have content?

W3C says the content cannot be block so what if :

<a name="foo">            
<h2>Foo Is Good</h2>           ( a likely location )

Where does the closer </a> go?

<a name="foo">&nbsp;</a>       is ok but uses a line
<h2>Foo Is Good</h2>

         Mason C

"Mason A. Clark" wrote:
Quoted text here. Click to load it

Any <a> tag requires a closing </a>.  This is because the anchor
(element using the <a> tag) may indeed have content; thus, a
closing tag is required to end the content whether or not the
anchor has any actual content.  

When I use the NAME attribute, I use a blank content:
    <a name="foo"> </a>
I put this just before the section of the page to which I want it
to apply.  Thus:
    <a name="foo"> </a>
    <h2>Foo Is Good</h2>
I do it this way because selecting the link
    <a href="#foo">Go To Foo</a>
with some browsers positions the window with the anchor at the very
top of the page.  With the anchor before the applicable section,
the section is then positioned slightly below the top of the page.  

I use the NAME attribute for the anchor instead of ID because NAME
is specifically the attribute for "the destination of another link"
(HTML 4.01 specification).  The ID attribute is more general and
thus less mnemonic.  Since I manually edit my HTML, mnemonic
markups are very important to me if I am to modify a page I haven't
touched in over a year.  


David E. Ross

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

Site Timeline