Old topics with no proper solution: reducing whitespaces in streamline app

Tried all alternative option including

st.write('<style>div.block-container{padding-top:2rem;}</style>', unsafe_allow_html=True)

still unable to have a concrete solution. The app removes the effect on browser refresh.

please suggest

Used this option too - Reduce whitespace from Top of the page in Sidebar as well as place two elements next to each other - #3 by Kishoren