I am looking to make the label of multiselect bigger / bolder, my code looks like this :
JavaScript
x
2
1
choice_mode = st.multiselect("Chose Mode", ['A','B','C'], default="*")
2
I have tried adding this :
JavaScript
1
4
1
st.markdown(".stTextInput > label {font-size:105%; font-weight:bold; color:blue;} ",unsafe_allow_html=True) #for all text-input label sections
2
3
st.markdown(".stMultiSelect > label {font-size:105%; font-weight:bold; color:blue;} ",unsafe_allow_html=True) #for all multi-select label sections
4
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 :
Am I doing this wrong? Could it be the streamlit version?
Advertisement
Answer
You should wrap the css in <style>
. You can write both css in one markdown
instead of having to repeat yourself.
Note: It’s a good practice to keep your code properly formatted, that will save you headache in the long run, when you are looking to refacture the code.
JavaScript
1
15
15
1
st.markdown("""
2
<style>
3
.stTextInput > label {
4
font-size:105%;
5
font-weight:bold;
6
color:blue;
7
}
8
.stMultiSelect > label {
9
font-size:105%;
10
font-weight:bold;
11
color:blue;
12
}
13
</style>
14
""", unsafe_allow_html=True)
15