Hiding the header in 1.31.1

Hi there

I’m using Streamlit 1.31.1 and Python3

I am using st.markdown to create a custom HTML header.

The issue is that there are a bunch of HTML tags/classes wrapped around this in the browser, such as:

<div class="st-emotion-cache-uf99v8....

How can I remove this boilerplate HTML wrapping around the content?

1 Like

Hello @streamlitisawesome,

You can use the st.markdown function with the unsafe_allow_html=True parameter to include custom CSS in your app.

hide_streamlit_style = """
            <style>
                /* Hide the Streamlit header and menu */
                header {visibility: hidden;}
                /* Optionally, hide the footer */
                .streamlit-footer {display: none;}
                /* Hide your specific div class, replace class name with the one you identified */
                .st-emotion-cache-uf99v8 {display: none;}
            </style>
            """

st.markdown(hide_streamlit_style, unsafe_allow_html=True)

Hope this helps!

Kind Regards,
Sahir Maharaj
Data Scientist | AI Engineer

P.S. Lets connect on LinkedIn!

➀ Want me to build your solution? Lets chat about how I can assist!
➀ Quick, practical management advice to leverage data and AI: Subscribe on LinkedIn
➀ Join my Medium community of 30k readers! Sharing my knowledge about data science and AI
➀ Website: https://sahirmaharaj.com
➀ Email: sahir@sahirmaharaj.com
➀ 100+ FREE Power BI Themes: Download Now

2 Likes