I put many columns in st.expander, if I change the screen size or add more columns, each column width will be smaller, and the button size will be changed.
is there any method to add a horizonal scroll bar in st.expander?
I put many columns in st.expander, if I change the screen size or add more columns, each column width will be smaller, and the button size will be changed.
is there any method to add a horizonal scroll bar in st.expander?
There are extra considerations if you have multiple expanders and want them styled differently, but in the simplest case:
import streamlit as st
with st.expander('Cat'):
st.write('Meow' + ' meow'*1000)
css='''
<style>
[data-testid="stExpander"] div:has(>.streamlit-expanderContent) {
overflow: scroll;
height: 400px;
}
</style>
'''
st.markdown(css, unsafe_allow_html=True)
Thanks and it works.
but it will still compress the column space and exceed the border of the expander。
I found a way to fix it.
hide = """
<style>
ul.streamlit-expander {
overflow: scroll;
width: 1500px;
</style>
"""
st.markdown(hide, unsafe_allow_html=True)
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.