Open In App

HTML5 MathML <mspace> Tag

Last Updated : 04 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML5 MathML <mspace> tag is used to insert customizable space within a mathematical expression. It allows you to control the width, height, and depth of the space for precise formatting. The size of the blank space has to be mentioned in the attributes.

Syntax

<mspace attributes="value"/>

Attributes

This tag accepts some attributes which are listed below:

AttributeDescription
class|id|styleHolds the styles of the child elements.
mathbackgroundHolds the background color value for math expressions.
depthHolds the desired depth below the baseline.
widthHolds the width value length.
heightHolds the desired height above the baseline.
linebreakDefines line breaks inside a line; possible values: auto, newline, nobreak, goodbreak, badbreak.

Below example illustrates the MathML <mspace> tag in HTML5:

Example: In this example we demonstrates the usage of the HTML5 MathML <mfenced> and <mspace> tags to display a mathematical expression. It includes superscripts and adjustable spacing between elements.

html
<!DOCTYPE html>
<html>

<head>
    <title>HTML5 MathML mfenched tag</title>
</head>

<body>
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>

        <h3>HTML5 MathML &lt;mspace&gt; tag</h3>

        <math>
            <mfenced open="(" close=")" separators="">
                <mrow>
                    <msup>
                        <mi>x</mi>
                        <mn>2</mn>
                    </msup>
                    <mspace depth="20px" height="40px" />
                    <mo>+</mo>
                    <msup>
                        <mi>y</mi>
                        <mn>2</mn>
                    </msup>
                    <mo>=</mo>
                    <msup>
                        <mi>z</mi>
                        <mn>2</mn>
                    </msup>
                </mrow>
                </mfenched>
        </math>
    </center>
</body>

</html>

Output:

Supported Browsers

The browsers supported by HTML5 MathML <space> tag are listed below:

  • Firefox

Next Article

Similar Reads