Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Displaying a square root with HTML

DZone's Guide to

Displaying a square root with HTML

· Web Dev Zone ·
Free Resource

Bugsnag monitors application stability, so you can make data-driven decisions on whether you should be building new features, or fixing bugs. Learn more.

This post shows two ways of displaying a square root with HTML.

Pure HTML for older browsers. The following HTML source

    &radic;<span style="text-decoration: overline">2</span>
is displayed as
2
Not 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
2
With 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:

 

From http://www.2ality.com/2011/10/html-square-root.html

Monitor application stability with Bugsnag to decide if your engineering team should be building new features on your roadmap or fixing bugs to stabilize your application.Try it free.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}