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

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.


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

no unfortunately it doesn’t.

Works ootb for me:



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:

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