html anchor tag displayed in middle not top

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

Threaded View

I have a question. I'm working on this website with a treeview style
menu coded in php. the menu autocreates itself by pulling data off a
mysql database. It has the capabilities to get quite large though and
when the page refreshes I want the  menu to display at the same place.
But The problem is in the  anchor tag im putting in there <a
name='$name'><a href=$php_self?var=$var&var2=$var2#$name>$name</a> when
the link is clicked that point in the menu displays at the top which
does not look good for a small menu. Any help on this would be great.
Is there a way to have it display 10 lines of test/200px/ any space
between the top of the page and the <a name> anchor. Thanks

Re: html anchor tag displayed in middle not top

Also sprach

Quoted text here. Click to load it

So, basically, that is more or less the same as
<a name="$name"></a><a href="#$name">Blah</a>
(Your code is missing a closing </a> tag!)

Quoted text here. Click to load it

Well - what else do you expect from this code? You define a named anchor and
on the same line a link to that very anchor.

Quoted text here. Click to load it

You said the menu had the capability of growing quite large. So a "small"
menu would be more or less an exception, in which case that behaviour could
simply be tolerated. Anyway, as you are generating it with PHP you can
easily check its size and simply drop the named anchor if the menu is not
large enough.

Site Timeline