Summary
When using html/css code with st.markdown, it creates an empty line space on UI
Steps to reproduce
Code snippet:
import streamlit as st
hide_st_style = """
<!-- CSS code -->
<style>
MainMenu {visibility:hidden;}
footer {visibility:hidden;}
header {visibility:hidden;}
</style>
"""
st.markdown(hide_st_style, unsafe_allow_html=True)
st.write("This is at the top")
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:: It should show the same UI with or without st.markdown
I made sure to not use two spaces in st.markdown to avoid next line
Actual behavior:
If we comment the st.markdown, the write element show the message at the top, but after using st.markdown, the UI enters a new line(empty) and the message from st.write goes in the next line hence increasing the margin from top.
Debug info
- Streamlit version: 1.24.0
- Python version: 3.8.17
- Using Conda
Is this behavior normal in streamlit?
I have a number of st.markdowns in the app I am trying to develop. When the st.header comes, it is displayed in the middle of the page due to st.markdown