HTML5 MathML displaystyle Attribute
Last Updated :
23 Jul, 2025
Improve
This attribute contains a Boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. This attribute is accepted by all the MathML tags.
Syntax:
<element displaystyle="true|false">
Attribute Values:
- true: This value defines that more vertical space is used for displayed equations.
- false: This value defines that more compact layout is used to display formulas.
Below examples illustrate the displaystyle attribute in HTM5 MathML
Example:
<!DOCTYPE html>
<html>
<head>
<title>HTML5 MathML displaystyle attribute</title>
</head>
<body>
<center>
<h1 style="color:green">
GeeksforGeeks
</h1>
<h3>HTML5 MathML displaystyle attribute</h3>
<math displaystyle="true">
<mrow>
<mrow>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mi>y</mi>
<mn>2</mn>
</msup>
</mrow>
<mo>=</mo>
<msup>
<mi>z</mi>
<mn>2</mn>
</msup>
</mrow>
</math>
</center>
</body>
</html>
<html>
<head>
<title>HTML5 MathML displaystyle attribute</title>
</head>
<body>
<center>
<h1 style="color:green">
GeeksforGeeks
</h1>
<h3>HTML5 MathML displaystyle attribute</h3>
<math displaystyle="true">
<mrow>
<mrow>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<msup>
<mi>y</mi>
<mn>2</mn>
</msup>
</mrow>
<mo>=</mo>
<msup>
<mi>z</mi>
<mn>2</mn>
</msup>
</mrow>
</math>
</center>
</body>
</html>
Output:

Supported Browsers: The browsers supported by displaystyle attribute are listed below:
- Firefox