How to make an html page start at a certain position?

Asked

Viewed 250 times

-4

When I enter my page her focus did not stay at the top but in the middle for example, it is possible?

  • 3

    What do you mean? Could you give concrete examples?

  • Like when I enter the page, I’d like her to nn get from the top understand?

  • It would be like going to a specific section?

  • when I clicked on a link

  • 1

    It’s possible, but there are several ways to do it that depend on what exactly you need. Could [Edit] the question and add a [mcve], composed of some code snippet, that reproduces what you want to do? There are ways to move the page to a certain element, or even a certain page height, but it’s not clear what you need. Something like "I have this page, I want it to start here..." is essential.

3 answers

0

0

If you want your page to open at some specific point, just reference the id of the location you want to start.

http://www.paginaexemplo.com/pagina.html#id

where the #id refers to the id within your html page.

Example:

/questions/349706/como-fazer-uma-p%c3%a1gina-em-html-come%c3%a7ar-em-uma-determinada-posi%c3%a7%c3%a3o#answer-349713

Paste the URL above into the browser and it will open the page directly in my reply, as the id Answer-349713 refers to my reply.

0


All right Vinicius?

You can use the anchoring method! If you have an ID of the exact location you want to take the user, just anchor it in this way:

<a href="#topo">LINK</a>
<div id="topo">
CONTEUDO
</div>

In case the function < a > will anchor to take the user to a specific part of the page.

I hope I’ve helped.

Browser other questions tagged

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