Change font size in st.write()?

Is it possible to change the fontsize and/or color in st.write()?

Hi @Soren,

If you want different sizes of fonts you have two options,

  1. Go with the standard set of typography provided by streamlit, ie. text, title, header and subheader
    https://docs.streamlit.io/en/stable/api.html#display-text
  2. Use st markdown and give sizes yourself, This will give you text size of your choice.
import streamlit as st

st.set_page_config(layout="wide")

st.markdown("""
<style>
.big-font {
    font-size:300px !important;
}
</style>
""", unsafe_allow_html=True)

st.markdown('<p class="big-font">Hello World !!</p>', unsafe_allow_html=True)

It looks like this for me :smiley:

Hope it helps !

6 Likes