Open In App

HTML5 MathML dir Attribute

This attributes holds the direction value. It holds two types of direction values ltr for left to right and rtl for right to left. This attribute is accepted by <math>, <mi>, <mo>, <mrow>, <ms>,  and <mtext>.

Syntax:



<element dir="ltr|rtl">

Attribute Values:

Below example illustrate the dir attribute in HTML5 MathML:



Example:




<!DOCTYPE html> 
<html
  
<head
    <title>HTML5 MathML dir attribute</title
</head
  
<body
    <center
        <h1 style="color:green"
            GeeksforGeeks 
        </h1
          
        <h3>HTML5 MathML dir attribute</h3
          
        <math dir="rtl"
            <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 HTML5 MathML dir attribute are listed below:


Article Tags :