PDA

View Full Version : Named Anchor


quintain
05-23-2005, 04:46 PM
Hi, can I use a named anchor and link from one page to the relevant anchor point in another page, it seems I should be able to but I cannot figure it out.
I am trying to link from a home page to about half way down a FAQ page, simply linking to the FAQ page is not really sufficient.

cperkins
05-23-2005, 07:17 PM
Named anchors are being phased out. Don't know if they are deprecated yet, but they probably are.


But the good news is that any id attribute can work where a named anchor used to be required.

For example, inside your FAQ document you might have the following

<p id="johngalt" class="question">Who is John Galt?</p>
<p class="answer"> yadda yadda yadda...</p>

And, then in the page you are linking from you would have somethin like this:

<a href="faq.html#johngalt">Who is John Galt?</a>


Hopefully I explained that well.

Thanks,

Chris Perkins

http://www.medialab.com/sitegrinder ('http://www.medialab.com/sitegrinder') <- Photoshop to the web plug-in
http://www.medialab.com/wellrounded ('http://www.medialab.com/wellrounded') <- DreamWeaver extension for making round cornered rectangular containers.

domedia
05-23-2005, 09:03 PM
I sometimes wish I could 'grade' answers :P
Welcome to the forums cperkins and thankyou for an excellent first post!

quintain
05-23-2005, 10:17 PM
Chris.
Thank You.What can I say that domedia has not already said.
Your reply was excellent and even I as a very-very occasional dreamweaver user was able to understand and adapt it. "However" how can I arrange it so that when I link to it the linked section appears about one perhaps two lines down from the top of the page.
I am still also using a named anchor from within the faq page and when I use that the text opens 1 or 2 lines down from the top of the screen.
Am I allowed to put the site name on this forum to show what I mean???

domedia
05-24-2005, 11:17 AM
Yes, you can link directly to the page in question.

quintain
05-24-2005, 11:50 AM
Thanks, I did not wish to cut across any procedures.
When using the link procedure recommeded by Chris the page opens up with the relevant script at the very top of the page. This can be seen by viewing www.disney-villavacation.com towards the bottom left of the home page is the link "proud to be private owners group" when selected the faq opens. How can I move it down 1 or 2 lines without adding visible spaces?

domedia
05-24-2005, 02:36 PM
Remove the space that's between the questions now. It's seems to be a paragraph with an old fashined anchor name which you're not going to use now anyways :) : <p align="left"><a name="q9"></a></p>
And instead add a CSS rule for your class="question" in your stylesheet that will add padding above the questions: .question {padding-top: 2em;}