Documentation

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Home
                    • MathPlayer
                    • MathML 3
                    • MathML 3

                    MathML and HTML5

                    Reading time: 1min

                    HTML5 updated HTML4 to help meet the needs of modern web architecture. One of those updates brought math support into HTML5 via MathML. Most MathML will work just fine in HTML5, but here are a few things to watch out for:

                    HTML5 normally doesn't care about namespaces and puts all of the elements in the HTML namespace; MathML and SVG are the two exceptions to this rule. For compatibility with XTHML 1.x and XHTML5, the math tag should include the MathML namespace as shown below:

                    <math xmlns="http://www.w3.org/1998/Math/MathML">
                    …
                    </math>
                    

                    Another namespace issue arises with the use of annotation-xml inside of semantics. Inside of MathML, all elements are placed in the MathML namespace with two exceptions: inside some annotation-xml elements and inside of mtext elements.

                    The first exception allows you to include an HTML alternative encoding inside of a semantics elements. The exception happens when the encoding attribute for annotation-xml is either "text/html" or "application/xhtml+xml". In these cases, the elements are placed inside the HTML namespace and can be manipulated by script or styled by CSS if made visible. For other encodings, the non-HTML5 elements are placed in the MathML namespace even if they are declared to be in another namespace (eg, http://www.openmath.org/OpenMath ). If you use XHTML5 which is namespace aware, namespaces inside of MathML should be handled properly.

                    The second exception is inside of mtext. HTML5 extends MathML by allowing HTML5 elements inside of mtext. These elements are placed in the HTML namespace. It is not recommended that you make use of this extension because it is unlikely to work in other environments.

                    If HTML tags occur elsewhere inside of a MathML element (with the two exceptions above), the MathML element is terminated (closed off) by the HTML5 parser at that point. That is almost certainly not what most authors intend, so care should be taken when adding HTML5 in MathML.

                    Was this article helpful?

                    Yes
                    No
                    Give feedback about this article

                    Related Articles

                    • Why MathML 3?
                    • MathML 3
                    • Menu reference list
                    • Trying MathML 3

                    Making people’s STEM work more meaningful

                    MathType

                    • MathType for Office Tools
                    • MathType for Mac
                    • MathType for Microsoft 365
                    • MathType for Google Workspace
                    • MathType for LMS
                    • MathType for XML Editors
                    • Arabic notation
                    • Our products accessibility
                    • MathType is online

                    WirisQuizzes

                    Learning Lemur

                    Solutions for Education

                    • Blackboard Learn
                    • Brightspace by D2L
                    • Canvas
                    • Google Classroom
                    • Moodle
                    • Schoology

                    Solutions for Publishing Houses

                    Solutions for Technical Writers

                    Solutions for Chemistry

                    Integrations

                    • HTML Editors
                    • MathType in WordPress

                    Pricing

                    Company

                    Careers

                    Blog

                    Contact Us

                    Buy Now

                    Plugin Downloads

                    © Wiris 2025

                    • Cookie Preferences
                    • Cookie Policy
                    • Terms of Use
                    • Privacy Policy / GDPR
                    • Student Data Privacy
                    • Compliance
                    • Powered by Helpjuice
                    Expand