Problems with integrating html to streamlit

If you’re creating a debugging post, please include the following info:

  1. Are you running your app locally or is it deployed?

Locally

  1. Share the Streamlit and Python versions.

Python 3.10.1 Streamlit, version 1.39.0

I have an issue when i try to integrate html or css with streamlit using components or markdown. For example in my code i have this function

def scroll_to_top():
components.html(
“”"

“”",
height=0,
width=0
)

which should take me to the top of the page when a button is clicked

if st.button("Confirm Selection and Proceed"):
    st.session_state.confirmed = True
    scroll_to_top()
    st.rerun()    

but it doesn’t work. Furthermore I try to change the appearance of a button with st.markdown, yet I am unable to do so.

    st.markdown(
        """
        <style>
        .stButton > button {
            padding: 2px 6px;     
            font-size: 14px;       
            min-width: 30px;       
            height: 30px;          
            border-radius: 4px;    
        }
        </style>
        """,
        unsafe_allow_html=True
    )

    for idx, neighbor_id in zip(neighbor_indices, neighbor_ids):
        col1, col2 = st.columns([1, 1])  # Adjust column widths for compact display
        with col1:
            st.write(f"Neighbor ID: {neighbor_id}")
        with col2:
            # Use Streamlit's button and apply custom CSS styling for the small "X"
            if st.button("❌", key=f"remove_{neighbor_id}_{selected_method}", help=f"Remove Neighbor ID {neighbor_id}"):
                st.session_state.removed_neighbors[selected_method].append(idx)
                st.rerun()

no matter what I change in the button’s style, the default appearance is seen when i run the app from VS code.