Where to set page width when set into non widescreeen mode?

Yes. Change it to reportview-container - > appview-container

Example :
import streamlit as st

def set_width(width: str):
st.markdown(
f"""

.appview-container .main .block-container{{ max-width: {width}; }}
""",
    unsafe_allow_html=True,
)

st.form(“test_form”)
st.text_input(“Text Input”)
wide_btn = st.button(“wide”)
centered_btn = st.button(“cent”)

if wide_btn:
set_width(“80%”)

if centered_btn:
set_width(“300px”)

1 Like