I want to use a CSS file to change the background of my web application, I have created a dynamic background with a CSS file and I want to use it in my application.
I have used the recommendations of the other forums, as they use it to put an image, but in this case I want to call a .css file to change the background and make my application look dynamic, so far I have not found documentation on the streamlit forums so I resort to the help of the community so that, in the future, if other users have the same concern they can use this module to have a guide of what to do.
I look forward to hearing from you.
Thank you very much
Actually, I want to display in the background of my application, a CSS file that generates a gradient style animation of 3 colors, the CSS code is as below:
What I want is to open and display the css as the background of the application, so that it looks dynamic. With images it already works but I am exploring if there is a way to work with a CSS file to give more dynamism to my web application.
The same principles apply. If you are familiar with css, you can see from the example which tags/classes to grab for your background. The element to grab is not body in this case; itβs .stApp (with an extra rule to remove the header if you want). The example shows how to include plain css. If you need to include any <script> .... </script> then you will need to use st.components.v1.html('<script>...</script>') instead.
import streamlit as st
st.title('A Random App')
st.write('Look at the pretty waves')
with open('./files/wave.css') as f:
css = f.read()
st.markdown(f'<style>{css}</style>', unsafe_allow_html=True)