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

Should you build your own web experimentation solution? Download this whitepaper by Optimizely to find out.

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

Implementing an Experimentation Solution: Choosing whether to build or buy?

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}