I'm writing some material using Markdown on Mou.
And the chemical formula need to be used frequently.
For example, I would typing
H<sub>2</sub>SO<sub>4</sub>
Then, the sulfate acid can be represent as H2SO4 .
But I can't figure out how to represent the anion type formula in html.
The figure shows like this:

I try to typing
SO<sub>4><sup>2-</sup></sub>
It shows like this: SO42-
You can use <sup> for the charge:
H<sub>2</sub>SO<sub>4</sub> + 2NaOH → 2H<sub>2</sub>O + Na<sup>+</sup> + SO<sub>4</sub><sup>2-</sup>
gives:
H2SO4 + 2NaOH → 2H2O + Na+ + SO42-
See this sample: https://jsfiddle.net/cp4n31qx/1/
This would even work without the CSS, I just used it to make it look better, here is a fiddle
HTML
<div>
<h2>
SO<sub>4</sub><sup>2-</sup>
</h2>
</div>
CSS
sub {
font-size:13px;
}
sup {
font-size:13px;
margin-left:-5px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With