r/jamt9000•
jamt9000

Subscript and superscript

Reddit now supports superscript officially with ^

Custom superscript and subscript so you can make formulae like:

NH4+
2H2O ⇌ H3O*+* + OH*-*
a*2* + b*2* = c*2*

*12*D + *13*T → 24He + n0

Here's the syntax:

*_subscript_* makes subscript
*`superscript`* makes superscript
*_sub_`sup`* makes subsup
*`sup`_sub_* makes supsub

And the CSS:

/* == Subscript and superscript == */

.md em{
    position: relative;
}

/* *_sub_* */
.md em em{
    font-style: normal;
    vertical-align: sub;
    font-size: 80%;
}

/* *`sup`* */
.md em code{
    font-family: verdana, arial, helvetica, sans-serif;
    vertical-align: super;
    font-size: 80%;
}

/* *_sub_`sup`* */
.md em em+code{
    position: absolute;
    left: 0;
    bottom: 1em;
    vertical-align: super;
}

/* *`sup`_sub_* */
.md em code+em{
    position: absolute;
    left: 0;
    top: 1em;
    vertical-align: sub;
}

Posted Mar 18, 2010, 5:58 AM UTC · edited

218
Loading comments…