How to go to a part of a text on the same page by clicking on a link above

Asked

Viewed 15,283 times

4

Imagine a page with a lot of text. What I want to do is make a word clickable that when the user clicks goes to another text on the same page.

I want to do this using XHTML and CSS.

I have at least one more idea that XHTML is used # but I can’t remember how to do it.

3 answers

5

<section id ="top">Texto</section>

<a href="#top">Clique aqui</a>

The link goes to Section.

5


Is called link link

Example with div:

<div id="tips">Useful Tips Section</div> <!-- crie um ID para a div ou span -->

Or with another link:

<div id="tips">Useful Tips Section</div>

Calling another link to the position of the previous div or link:

<a href="#tips">Visit the Useful Tips Section</a> <!-- Utilize esta Id com # no link para ir até este local -->

Calling the link on another page:

<a href="http://www.w3schools.com/html_links.htm#tips">Visit the Useful Tips Section</a>

Here you need to pass the full url of the site because you are using it in another location, other site, etc, but it works, will point exactly to the div id = "tips"

Source:http://www.w3schools.com/html/html_links.asp

  • I’m sorry, I don’t understand. For example I want to make the word Rcelo a link and when clicked go to a part of the end of the same page that says Aymone. How do I do this in xhtml and css?

  • You will encapsulate the word you want within a div or other element, such as a span, will assign an ID to this span or div. then you create a common link, with the href='#id' property of span or div, etc.

4

Just for example, using section to place the text you want to link and place a id in that section:

<section id="minhaTag">
    <!-- o meu texto -->
</section>

Then just use this id in the reference word for the text:

<a href="#minhaTag">Palavra de link para o texto</a>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.