Streamlit css parameters (padding, colors)

Hello everyone,
First of all a massive thank you to the developpers at Streamlit !! Great job !!

I’m wondering if someone could help me with the tuning of css parameters so I can avoid having a big vertical space between a simple text line (st.write) and a title (st.title).
As I’m not familiar with css, I don’t really know how to handle it.
Is there a way to display the default ccs parameters ? That could be a good start for finding my way through.

Bonus question : I’d like to change the color of only 1 word. How can I do that ?

Thank you

1 Like

Ok folks, so here is the solution I’ve found so far. Don’t judge me, I’m still a rookie :grin:

For the vertical space I managed to do this :

st.title("Some title")
vert_space = '<div style="padding: 180px 5px;"></div>'
st.markdown(vert_space, unsafe_allow_html=True)
st.write('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.')

And for the color of the text :

signature = '<p style="color:grey; font-size: 14px;">some texte</p>'
st.sidebar.markdown(signature, unsafe_allow_html=True)

It’s note a change of color for only one word but it makes the job for me for now.
And I didn’t find a way to display the default css params so far.

I hope this will be helpful for someone else.

Don’t hesitate to update with better practice :wink:

1 Like