PDA

View Full Version : HTML



steresa
November 3rd, 2006, 09:22 AM
I have a few links "auto", "health", "finance", etc. I wan't the veiwer to be directed exactly to where the content is say if he clicks on "auto". The problem is, the "auto" text is half way down the page so you would have to scroll to see it. The viewer would see "finance" at the top and would be confused. How can I make the "auto" link go right to the beginning of the "auto" text? I know it's an HTML tag and I don't think it's to hard.

duncanhall
November 3rd, 2006, 12:08 PM
You need to use the 'name' attribute of the anchor tag. For example, at the beginning of your 'auto' text, have a heading (perhaps an h2 if we want to be semantic), and wrap this heading in an anchor tag. Give this anhor tag a name attribute (eg name="auto"). Then, point your auto link at the top of your page to this named anchor by prefixing the anchor name with a '#'.

Suitably over-confusing? I thought so.




<a href="#autoSection">Autos</a>
....
...
...
..
...
..
...

<a name="autoSection">Autos</a>
Auto text blah blah blah