How to create a text hyperlink aligned centrally

Hey @Alex-Robson, welcome to the Streamlit forum!

You can center a link as follows:

import streamlit as st

# not centered
st.markdown(
    """<a href="https://www.example.com/">example.com</a>""", unsafe_allow_html=True,
)

#centered
st.markdown(
    """<a style='display: block; text-align: center;' href="https://www.example.com/">example.com</a>
    """,
    unsafe_allow_html=True,
)

1 Like