Hello, I want my streamlit app to start at the top of the page after it is loaded, but for some reason it just jumps to the middle of the page. Is there anyway I can configure my app so it start at the top of the page every time it’s loaded?
Hi @corsilt, welcome to the Streamlit community!
Without seeing your code, it’s pretty hard to make any suggestions. Do you have a code snippet that demonstrates this behavior?
Best,
Randy
Hi Randy, I am encountering the same problem, I was hoping you can through me some light.
this is one of the two pages:
I had the same even before splitting my app into pages, with pretty much the same code.
Thanks a lot for any help.
Hi @franasa -
Unfortunately, your app doesn’t display this behavior on my Ubuntu machine. What size browser window are you using?
Best,
Randy
Thanks @randyzwitch for your answer, I see this on Chrome on an android phone, an iPad and an iPhone, and on Chrome and Firefox on Fedora 35 Linux, don’t have windows or mac at hand now.
The page starts on top and after less than one second jumps to the selection section.
edit: 1920 x 1001 is my laptop’s browser size, just tried other sizes, same behaviour.
I am also experiencing this issue with my webpage. Was a solution ever provided?
Unfortunately not, since it’s so hard to reproduce.
Hello.
I think I have the same problem, in which after browsing the pages of my streamlit app, and for example being on a page other than the initial one (main), my streamlit app reloads and returns to the initial page, or I change tab in the browser and when I return to the tab of my streamlit app it reloads too; I thought it was because of the browser used but both firefox, edge and chrome, I get the same result, differentiating the times in which the streamlit app rerun automatically.
Thanks a lot for any help.
I have the same issue. I go to my http://localhost:8501/, and Home.py loads fine but it jumps to the middle of the page.
Moreover, I have a multipage app. So when I go to other page, and then I come back to Home.py, the page is displayed correctly (I’m on Chrome).
I fixed by avoiding adding st.subheader
in the middle of the page.
Hi corsilt, its my first message here,
I’ve had the exact same problem and it was due to the way I use line breaks.
The anchor that made my app jump in the middle was a "st.markdown(‘#’)',
I’ve removed it and now it start at the top !
You can add a “st.write(‘#’)” on top of your page.
thank you! adding the st.write(“#”) to the top was what finally worked for me.