Forum Home
Press F1
 
Thread ID: 134304 2013-06-18 08:43:00 HTML help Ninjabear (2948) Press F1
Post ID Timestamp Content User
1346292 2013-06-18 08:43:00 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
Ninjabear (2948)
1346293 2013-06-18 09:59:00 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>
pcuser42 (130)
1346294 2013-06-18 20:33:00 A similar way to do it is with
<a name="top"></a>

and then the href with #top

Good luck with the website :thumbs:
Nerdtastic (16693)
1346295 2013-06-18 20:57:00 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.
pcuser42 (130)
1346296 2013-06-19 09:28:00 Isn't there something about articles in HTML5, which can do the trick, though I can't point you in any directions... SanChippy (16951)
1346297 2013-06-19 09:32:00 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>. :)
pcuser42 (130)
1