DarkWolfModding
DarkWolfModding

Reputation: 37

linking to another part of the same page

I've been looking around online for a solution but the methods I've found don't work. The methods online tell me to do this

Make a div with a class and ID I make one like this

<div class="paragraphBackground" id="paragraphBackground">
<p class="paragraphContent">content of    paragraph</p></div>

then it says to make a link like o have below.

<a href="#paragraphBackground" name="paragraphBackground">Goto paragraph</a>

But when I click on the goto paragraph it doesn't do anything.

What I'm wanting to use this for is a html readme for a mod that contains a sidebar on the left that shows all the contents of the readme and when you click on one of the links it will jump you to that section in that same HTML file.

Upvotes: 0

Views: 94

Answers (3)

Ian Hazzard
Ian Hazzard

Reputation: 7771

Just use the following for the link: <a href="#readme">.

For the part that you want to scroll to, use this: <div id="readme">Read me!</div>

JSFIDDLE HERE.

Upvotes: 1

Kritner
Kritner

Reputation: 13765

Are you looking for something like this?

http://jsfiddle.net/huntmg90/

Basically you set a <a name="identityofanchor" /> in front of your text you want linked, then to link to it you do a <a href="#identityofanchor">label of anchor</a>

Upvotes: 2

Gene Parcellano
Gene Parcellano

Reputation: 6044

Your link will need to look something like this:

<a href="#paragraph1">Paragraph 1</a>

And the corresponding content needs to have:

<a name="paragraph1">Paragraph 1</a>

Here's a Fiddle to help: http://jsfiddle.net/m0nk3y/9mx5yx7d/

Upvotes: 1

Related Questions