Skip to content

Instantly share code, notes, and snippets.

@quezo
Created May 22, 2018 17:24
Show Gist options
  • Save quezo/4f263e799a85d25ae3eda35bebdaad28 to your computer and use it in GitHub Desktop.
Save quezo/4f263e799a85d25ae3eda35bebdaad28 to your computer and use it in GitHub Desktop.
<sup> & <sub>: Math Sums & Products
<p>x<sub>1</sub> = 1, x<sub>2</sub> = 2, x<sub>3</sub> = 3, y<sub>1</sub> = 4, y<sub>2</sub> = 5 and y<sub>3</sub> = 6. Find:<br/><span>&#x03A3;<sup class="sum">3</sup><sub class="sum">i = 2</sub> x<sup>2</sup><sub>i</sub> + y<sub>i</sub><sup>3</sup></span><br/>And:<br/><span>&Pi;<sup class="sum">2</sup><sub class="sum">i = 1</sub> (x<sub>i</sub> + y<sub>i</sub>)<sup>2</sup></span>
</p>
$("sub").each(function() {
if (this.previousSibling.tagName == "SUP") {
this.style.marginLeft = "-0.55em";
}
});
$("sup").each(function() {
if (this.previousSibling.tagName == "SUB") {
this.style.margin = "0 -0.24em 0 -0.32em";
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
@import "https://fonts.googleapis.com/css?family=Roboto+Slab:300,400";*{margin:0;padding:0;box-sizing:border-box;position:relative;font-family:'Roboto Slab',serif}body{background:#ECEFF1}p{font-size:45px;line-height:1.8;color:#455A64;font-weight:300;text-align:center;margin:1.3em}span{font-size:85px;transition:all .3s;cursor:pointer}sup,sub{font-size:.4em;vertical-align:unset;font-weight:400}sup{bottom:1em}sub{top:.2em}sub.sum{top:0}sup.sum{bottom:1.1em}span:hover{color:#E53935}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment