Hiding Background Image After Logging In

Hello guys,

Just wanted to ask if it is possible to Hide the Background image after logging in.

Currently, I have this code that sets the background image of the Application. However, the problem is how can I disappear/hide the image after logging in back to plain white again.

CSS:
st.markdown(
“”"

.stApp {
background-image: url(“#”);
background-attachment: fixed;
background-size: cover;
}

“”",
unsafe_allow_html=True
)

Thank you in advance.

You can just make the css only load if the person is not logged in, like this

import streamlit as st


def is_logged_in():
    return st.checkbox("Log in")


if not is_logged_in():
    st.markdown(
        """
    <style>
        .stApp {
            background-image: url("http://placekitten.com/400/200");
            background-attachment: fixed;
            background-size: cover;
        }
    </style>
    """,
        unsafe_allow_html=True,
    )

else:
    pass
1 Like

Thanks @blackary. Will try this on my end.