Open In App

HTML5 MathML dir Attribute

Last Updated : 16 Nov, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • ltr: This value holds the direction from left to right.
  • rtl: This value holds the direction from right to left.

Below example illustrate the dir attribute in HTML5 MathML:

Example:

HTML




<!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:

  • Firefox


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads