How to make a page in html start in a certain position? [closed]

-4

When I enter my page, the focus of it does not stay on the top but in the middle, for example, is it possible?

    
asked by anonymous 12.12.2018 / 20:25

3 answers

0

Is Vinicius okay?

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

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

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

I hope I have helped.

    
12.12.2018 / 20:41
0

You want the scrolling already started in a certain position.

The snippet should work: window.scrollTo(0,150)

To call it at the beginning of the run, use:

window.onload = function(){
     window.scrollTo(0,150)
}

I've done a working example: link

This will cause scrolling to drop by 150px

  

link

    
12.12.2018 / 20:32
0

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

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

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

Example:

https://pt.stackoverflow.com/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 above URL into the browser and it will open the page directly in my answer, because the answer-349713 id is for my answer.

    
12.12.2018 / 20:35