Can't add background color with css

Hi
I am new to streamlit, actually just started today so i am sorry if this is obvious but i wasn’t able to figure it out by searching.
I am trying to work around css and html codes and i have ran into some problems. for now my main concern is changing background color.
using components.html and markdown i was able to display css/html code but any try at changing background results in this:


Going into wide mode only makes the box bigger but it doesn’t cover the whole page.
This is the last css code i used.

<style>
body {
  background-color: lightgrey;
}

</style>

I would also like to know if it’s possible to combine python with html and css, something like this:

streamlit.markdown(f"<h3>Today is:{streamlit.write(str(date.today()))}</h3>",unsafe_allow_html=True)

the code above shows todays date in first line and in second it shows:“Today is:None

Hey @new672,

First, Welcome to the Streamlit community! :tada: :partying_face: :partying_face: :tada: :tada: :nerd_face:

So, usually people only have to use the CSS workaround now if that want to do a one-off change of a title, or colour etc…

As of Streamlit v 0.78 you can create your own custom colour theme for your app native to Streamlit! Check out the links below to learn how!

Our youtube tutorial: How to build custom themes for your Streamlit app - YouTube
Blog post: Announcing Theming for Streamlit apps! 🎨
Documentation: Create an app — Streamlit 0.82.0 documentation

Happy Streamlit-ing!
Marisa

2 Likes