How to indent bullet point list items?

Python==3.9
streamlit==1.11.0

You can use css to indent ul.

import streamlit as st

st.write("The following list won’t indent no matter what I try:")
st.markdown("- Item 1")
st.markdown("- Item 2")
st.markdown("- Item 3")

st.markdown('''
<style>
[data-testid="stMarkdownContainer"] ul{
    list-style-position: inside;
}
</style>
''', unsafe_allow_html=True)

or:

import streamlit as st

st.write("The following list won’t indent no matter what I try:")
st.markdown("- Item 1")
st.markdown("- Item 2")
st.markdown("- Item 3")

st.markdown('''
<style>
[data-testid="stMarkdownContainer"] ul{
    padding-left:40px;
}
</style>
''', unsafe_allow_html=True)

2 Likes