PDA

View Full Version : HTML help



Ninjabear
18-06-2013, 08:43 PM
Hi Guys

Trying to find a way to do this below but can't seem to find a site that can teach me.

Subtitle 1 , Subtitle 2, Subtitle 3.




Subtitle 1.

Some words.
Some more words

(Back to Subtitle 1 at the top)


Subtitle 2.

Words
Again more words
(Back to Subtitle 1 at the top)


So what I'm trying to do is when I click "back to subtitle 1 at the top", I'm wanting the webpage scroll back to the list of Subtitle 1, Subtitle 2 and Subtitle 3.
Can this be done using HTML?


Thanks

pcuser42
18-06-2013, 09:59 PM
It can :)

Give the subtitle tags an ID, then link to that ID - example:


<h1 id="anchor">Subtitle 1</h1>
Blah blah
<a href="#anchor">Back to top</a>

Nerdtastic
19-06-2013, 08:33 AM
A similar way to do it is with
<a name="top"></a>

and then the href with #top

Good luck with the website :thumbs:

pcuser42
19-06-2013, 08:57 AM
A similar way to do it is with
<a name="top"></a>

and then the href with #top

Good luck with the website :thumbs:

Personally I wouldn't do that any more as <a name=""> isn't valid in HTML5.

SanChippy
19-06-2013, 09:28 PM
Isn't there something about articles in HTML5, which can do the trick, though I can't point you in any directions...

pcuser42
19-06-2013, 09:32 PM
Isn't there something about articles in HTML5, which can do the trick, though I can't point you in any directions...

The <article> tag is a block-level section tag, much like <div>. :)