Jump to content

Using <a id=".."> navigation links


Vikingwarrior
 Share

Recommended Posts

I am trying to build navigation links from a main page (using <a href="...html") to a series of subsidiary pages each with a "Return" link of the type <a href="....html#january">, <a href="....html#february">, etc. I have used <a id="january"></a>, <a id="january" />, <a name="january"></a>, etc etc, but the "Return" always goes to the bottom of the main page, not to the target "january", "february" etc which are in the middle of a long page. It's driving me nuts. Has anyone got an answer, please?

Link to comment
Share on other sites

Hi Krewe: My main file is .....index.html and includes the following code: <div class="layout15"><H2><a id="programme"></a>Programme of events for 2012</H2></div><div><div class="layout16"><a href="20120120.html">20th January</a></div><div class="layout16"><a href="20120217.html">17th February</a></div><div class="layout16"><a href="20120316.html">16th March</a></div><div class="layout16"><a href="20120420.html">20th April</a></div><div class="layout16"><a href="20120518.html">18th May</a></div><div class="layout16"><a href="20120609.html">9th June</a></div><div class="layout16"><a href="20120714.html">14th July</a></div><div class="layout16"><a href="20120915.html">15th September</a></div><div class="layout16"><a href="20121019.html">19th October</a></div><div class="layout16"><a href="20121116.html">16th November</a></div></div> The above code (layout16) spreads the 10 links equally across the display, and takes the reader to the 10 separate .html files. The following code is the "Return" code at the foot of each of the 10 subsidiary pages, which should return the reader to the target <a id="programme"></a>, but which goes directly to the foot of the index.html main page. <div class="layout15"><a href="index.html#programme">Return</a></div> Am I doing something wrong? Help, please! David the Viking.

Link to comment
Share on other sites

What browser are you using? Do you have a Doctype declared? The id should theoretically work with any element, but try moving the id to the h2 and removing the a.Or try changing it from id to name on the a element. Either way should work (though, the first is recommended since the name attribute is deprecated).

Link to comment
Share on other sites

Hi folks: Further to my message yesterday, please see http://www.lancsarchsoc.org.uk/index.html for the full listing. I have tried <h2 id="programme"></h2>, <a name="programme"></a>, <a id="programme" />, etc etc. I use Firefox as standard, but also run all my pages through Chrome, IE, Opera and Safari, after using the Validator. Why does the target not work, please?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...