Leading Gap

Hi,

I upgraded to Streamlit, version 1.21.0 today.

I used a simple command: st.subheader(f"**Project Setup: Subjects:**")

Please refer to the attached pix. Can someone from Streamlit explain the logic of having such a leading gap between the top of the page and the 1st entry, that changes with every new release, or the wisdom of not having commands to make any such corrections with code?

Untitled

Apologies for the frustration in trying to inspect the JSโ€ฆ but am downgrading to 1.16 until I can figure out a resolution.

Shawn

1 Like

Hi Shawn! :wave:

I hope youโ€™re doing well! :slight_smile:

Iโ€™m not sure, but Iโ€™ve asked one of the developers to get back to you on this.

Thanks for your patience.

Best wishes,
Charly

1 Like

Iโ€™ll fish for more info to understand that potential gap discrepancy, but for now, hereโ€™s CSS hack from our very own @snehankekre! :slight_smile:

For 1.21.0, you can use this CSS hack to remove the top padding. Unsure what the unintended consequences are though elsewhere in the app:

st.markdown(
    """
<style>
div[class^="block-container"] {
    padding-top: 0rem;
}
</style>
""",
    unsafe_allow_html=True,
)

I hope that works for you.

Best,
Charly

2 Likes

Hi @Charly_Wargnier and @snehankekre, thank you for the code. I had struggled with it.

I do suggest that Streamlit factor in some cosmetic options for its widgets, that end users can use via code. Hacks can only go so far, and until the next version release. It stands to reason that if something is available via a hack, then it is possible to add it to the core product.

Thanks once again.

Cheers

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.