How to Create Links to Within the Same Page in HTML 


               


How to Create Links to Within the Same Page in HTML

HTML


In this article, we show how to create links to within the same page using HTML.

We've all seen this feature on sites such as Wikipedia, where you click on a link such as from the table of contents, and the page jumps to that section within the same page. For example, if you're reading a biography of a person, you may have the option to jump ahead to "Early Life", "Personal Life", etc. So how is this done?

To create a link that simply moves the user to another location on the same page, create the link that allows you to jump to that section. This is done with the HTML code.

<a href="#choose_name">Text</a>

The link will jump to the section on the page named choose_name, but now you must create the actual section named choose_name for it to work. A link by itself does nothing unless there's a section that the link goes to.

To create the section, choose_name, type in the following HTML code:

<a name="choose_name">Text</a>

Below is an example of links to within the same page:

John
Personal Life
Occupation
Discoveries

Let's create one ourselves.

John Wilscot

Personal Life
John Wilscot was born in Fort Lauderdale, Florida. He grew up with three other siblings, two brothers and one sister. His father was a dentist and had his own clinic while his mother was a Head nurse.

From an early age, John showed a talent for sciences and mathematics. While attending school, the teachers saw his astute ability to perform advanced mathematics in very specialized fields.

Occupation
Using his strong abilities in science and mathematics, John pursued a career in chemistry and became a chemist. He started out in the company in 1994 and took a role as an assistant researcher. He worked under the head researcher for three years before he moved up in the role as senior researcher.

Discoveries
It was during this time as senior researcher that John made his most crucial discovery that put him on the hall of fame. John discovered a chemical solution that was able to purify the earth's atmosphere. It was a solution that sprayed into the air was able to dissolve and cleanse any smog that was in the atmosphere.

The HTML code to produce the above content is shown below.



HTML Comment Box is loading comments...