Sorry for the late response, I am not sure how to approach this. I did use this approach to change the sidebar image only, you can see that I call the [data-testid=“stSidebar”] div and set an image - code below:
Go to the white bar, inspect element and find the information on the name on the right. Try to change the name of the data-testid in the code below ([data-testid=“stSidebar”]) to the name you found on the right:
It takes a bit of practice to find the correct css classes/attributes to use, and between Streamlit versions those CSS classes will change which is why you need to be able to find them by yourself through the devtools
As far as I know the Lottie JSON encodes a full animation. You would probably need to extract an image from the animation to use as background image using Lottie Editor: Edit and customize Lottie animations - LottieFiles . The browser won’t know how to interpret the Lottie animation to use as background.
hi, i have been trying to add background image for my web page from my local disk ,but its not working the code you provided,here is my code: from PIL import Image
Title of the web app
st.title(“NOVO STAR eCRF Generator”)
Load the background image
st.cache(allow_output_mutation=True)
def get_base64_of_bin_file(bin_file):
with open(bin_file, ‘rb’) as f:
data = f.read()
return base64.b64encode(data).decode()
Thank you so much, this worked for me too.
As mine is a chat window, i have added a background with the code below(same as yours) but the scroll is not working. any suggestions?
titleimg = “static/Picture7.png”
def set_bg_hack(main_bg):
# set bg name
main_bg_ext = “png”