【问题标题】:How to remove extra spacing before the title in streamlit?如何在streamlit中删除标题前的额外间距?
【发布时间】:2021-11-05 22:30:48
【问题描述】:

我已经构建了一个基本的流光应用。我想知道是否有办法删除标题上方的额外空间。在附图中,您可以看到地址栏和标题之间有明显的差距

【问题讨论】:

    标签: python-3.x streamlit


    【解决方案1】:

    您可以通过在视图中注入一些 css 来做到这一点:

    import streamlit as st
    
    st.set_page_config(layout="wide")
    
    padding_top = 0
    
    st.markdown(f"""
        <style>
            .reportview-container .main .block-container{{
                padding-top: {padding_top}rem;
            }}
        </style>""",
        unsafe_allow_html=True,
    )
    
    st.title("My Next Best Actions")
    
    st.sidebar.text_input("foo")
    

    ]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-13
      • 1970-01-01
      • 1970-01-01
      • 2011-11-29
      • 2013-01-28
      • 2011-07-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多