Subscript in slider text

Hello! Is there a way to use subscript format for text next to a slider?
For example: CO2, the 2 should be subscript
image

Hi @R_D , try copy-pasting the text (CO2) from another document (say pdf) where it is displaying correctly, into the label part of the slider widget in your code. Maybe it will work.

Cheers

You can use subscript characters like COβ‚‚. Not every font will show it correctly, though.

no unfortunately it doesn’t.

Works ootb for me:

st.slider("COβ‚‚")

slider

Try this: st.markdown("CO<sub>2</sub>", unsafe_allow_html=True)
This will appear properly in every browser as it is basic HTML.

It finally worked but I had to copy the subscript 2 from the Character Map based on this link: https://www.ctech.com/frequently-asked-questions/how-do-i-get-subscript-or-superscript-characters-in-my-data-files/
Thanks!

This works in general but I need it in the slider text.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.