How to make subscript and superscript in Dash

I want to write H2 with an underscript. I have try:

html.Div([‘H_2’])
html.Div(r’H_2’])
html.Div(r’$H_2$’])
html.Div('H2<\sub>])

But nothing seems to work. What Am I missing?

Thanks

Michaël

Hi @Mlevesque

You can use the html.Sub() and the html.Sup() for subscripts and superscripts:

html.Div(["H", html.Sub(2), "H", html.Sup(2)])

image

1 Like

Thanks It work very Well!