Fractions in HTML
inline-block display style. It works in all major browsers, except for Firefox earlier than version 3. Here's the code
<style>
.fraction {
display: inline-block; vertical-align: middle;
font-size: 50%; text-align: center;
}
.fraction span { display: block; }
.fracdenom { padding-top: .05em; border-top: .125em white solid; }
</style>
<p>Compute
3 <span class="fraction">
<span>1</span>
<span class="fracdenom">400</span>
</span>+
<span class="fraction">
<span>399</span>
<span class="fracdenom">400</span>
</span> without your pocket calculator!
</p>
And this is what it looks like:
Compute 3 1 400 + 399 400 without your pocket calculator!
Unfortunately, you have to tweak it for ever page to make it look good; and it displays differently on each and every browser (for one thing: Firefox handles the "inline-block" setting correctly only since version 3).
Labels: fractions, HTML, mathematics

