How to make label in st.multiselect bigger/bolder

I am looking to make the label of multiselect bigger / bolder, my code looks like this :

choice_mode = st.multiselect("Chose Mode", ['A','B','C'], default="*")

I have tried adding this :

st.markdown(".stTextInput > label {font-size:105%; font-weight:bold; color:blue;} ",unsafe_allow_html=True) #for all text-input label sections

st.markdown(".stMultiSelect > label {font-size:105%; font-weight:bold; color:blue;} ",unsafe_allow_html=True) #for all multi-select label sections

from this page : https://discuss.streamlit.io/t/the-problem-changing-label-font-of-text-input-and-multi-select/23329

but all it does is display the text on my app like so :
enter image description here

Am I doing this wrong? Could it be the streamlit version?

>Solution :

You should have the css in a <style>

st.markdown("""
<style>
.stTextInput > label {
font-size:105%; 
font-weight:bold; 
color:blue;
}

.stMultiSelect > label {
font-size:105%; 
font-weight:bold; 
color:blue;
} 
</style>
""", unsafe_allow_html=True)

Leave a Reply