I would like to have a Streamlit app, but with a custom header bar right at the very top, styled with custom CSS (and maybe even using a bit of Javascript)
Is this possible? If so, how?
I see lots of things about how to make custom components. But I’ve not found anything about bits that wrap the components. There is some information about themes, but I’ve not found out how to use them to control the HTML
@Charly_Wargnier I think it’s certainly a good start! It looks like it doesn’t quite push down the content of Streamlit though, and instead puts the header over the top of everything? Will investigate…
I am still wrestling with building an image-banner at the top of my streamlit-app, even though I have browsed tons of articles and watched the linked video. Still, I am not successful at getting the image hovering on the top of the page like a banner.
# Function for loading css stylesheet
def local_css(file_name):
with open(file_name) as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
local_css('style.css')
# Get the html-content of the .html-file
html_doc=codecs.open('index.html', 'r', 'utf-8').read()
# Parse the html file
soup = BeautifulSoup(html_doc, 'html.parser')
# Format the parsed html file
html_string2 = soup.prettify()
st.markdown(html_string2, unsafe_allow_html=True)
The ‘index.html’ file looks something like this:
While the associated css-file has a very simple and easy content as follows:
The final output looks like this. It seems as something is wrong with my html-code.
The sidebar-image gets loaded, but not the banner header-image… Why? Do you think you could help me with it and give some hints?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.