[Python] How to change label font size in streamlit

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I want to change the fontsize of the label above an input widget in my streamlit app.

    What I have so far:

    import streamlit as st
    label = "Enter text here"
    st.text_input(label)


    This renders the following: [​IMG]

    I want to make the label "Enter text here" bigger.

    I know there are various ways to change fontsize in st.write(). So, I tried some of them:

    • the markdown headers syntax:
      st.write(f"# {label}") # <--- works
      st.text_input(f"# {label}") # <--- doesn't work
    • some CSS:
      s = f"<p style='font-size:20px;'>{label}</p>"
      st.markdown(s, unsafe_allow_html=True) # <--- works
      st.text_input(s) # <--- doesn't work

    but as commented above, neither work. How do I make it work?

    Continue reading...

Compartilhe esta Página