-4
When I enter my page her focus did not stay at the top but in the middle for example, it is possible?
-4
When I enter my page her focus did not stay at the top but in the middle for example, it is possible?
0
You want the scroll to already start at a certain position.
The section must work: window.scrollTo(0,150)
To call it at the start of the run use:
window.onload = function(){
window.scrollTo(0,150)
}
I made an example of how it works: https://codepen.io/xstarman/pen/maewxP
This will cause the scroll to drop to 150px when loading
https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo
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 html
You are not signed in. Login or sign up in order to post.
What do you mean? Could you give concrete examples?
– Woss
Like when I enter the page, I’d like her to nn get from the top understand?
– Vinícius Fernandes
It would be like going to a specific section?
– GeekSilva
when I clicked on a link
– Vinícius Fernandes
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.
– Woss