Aligning text in ag grid column header

I attempted to use the solution here: Streamlit AgGrid Header Formatting - :jigsaw: Streamlit Components / streamlit-folium - Streamlit
but none of the headers changed. I also used custom css code here: css = { ".ag-header-cell-label": {font-size": "10px !important"}, "ag-header-cell-label":{justify-content": "center!important"} to no avail. I am unsure what to do next, please let me know and thank you.

Thanks for your question @slimreaper, and welcome to our forums! :raised_hands:

In your CSS, try to specify the justify-content style for .my-header-class:


css = """
<style>
    .my-header-class .ag-header-cell-label {
        justify-content: center !important;
        font-size: 10px !important;
    }
</style>
"""

st.markdown(css, unsafe_allow_html=True)

Let me know if that works for you.

Best wishes,
Charly

1 Like

Glad this solution worked for you @slimreaper! :hugs:

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