Displaying a square root with HTML
Join the DZone community and get the full member experience.
Join For FreeThis post shows two ways of displaying a square root with HTML.
Pure HTML for older browsers. The following HTML source
√<span style="text-decoration: overline">2</span>is displayed as
√2Not all browsers display the above equally well, but it is always readable.
MathML for newer browsers. The following HTML source
<math><msqrt><mi>2</mi></msqrt></math>is displayed as
2With MathML being part of HTML5, all modern browsers support MathML. Which is a god-given for those of us who remember the HTML documents that were generated from LaTeX source files by converting formulae to bitmap graphics.
Related reading:
- Displaying math in HTML [mentions MathJax which allows you to use MathML in older browsers]
HTML
Opinions expressed by DZone contributors are their own.
Comments