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?