Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have one word press project and in that index page is having 7 menus like home, about, contact, offering, invitation, evolution and downloads now how to set the this links such that on clicking it doesn't open another page but go to the bottom of same page where i have added contents of each page.

share|improve this question
add comment

1 Answer 1

You should use anchors to do this.

From W3C:

When the name or id attributes of the A element are set, the element defines an anchor that may be the destination of other links.

Authors may set the name and href attributes simultaneously in the same A instance.

and...

The id attribute may be used to create an anchor at the start tag of any element (including the A element).

...

The id and name attributes share the same name space. This means that they cannot both define an anchor with the same name in the same document. It is permissible to use both attributes to specify an element's unique identifier for the following elements: A, APPLET, FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a single element, their values must be identical.

So you need to place an anchor somewhere in your page and then set your link to point to that anchor (using # character).

For example:

Add this to your menu:

<a href="#anchor-one">Go to anchor one</a>

And this somewhere on your page:

<a name="anchor-one">This is the location of anchor one.</a>

You can also use id attribute as anchor. So this will work too:

<a href="#section2">Go to Section Two</a>
...
<H2 id="section2">Section Two</H2>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.