HTML5 | MathML <mfrac> tag

The HTML5 MathML <mfrac> tag is an inbuilt element in HTML5. It is use to add fraction symbol between two digits or equations.

Syntax:

<mfrac> numerator denominator </mfrac> 

Attributes: This tag accepts below mentioned attribute:

  • bevelled: This attribute holds the value how the fraction will be displayed if the value is true then numerator and denominator are displayed side by side and separated by a slash. If the value is false(default value) displayed numerator and denominator are on top of each other.
  • class| id| style: This attribute is used to hold the styles of the child elements.
  • href: This attribute used to hold any hyperlink to a specified URL.
  • mathbackground: This attribute holds the value of the math expressions background color.
  • mathcolor: This attribute holds the color of the math expressions.
  • denomalign: This attribute holds the alignment value of denominator, possible values are left, center and right.
  • linethickness: This attribute holds the value of the thickness of the fraction. Possible values are thick, medium and thin.
  • numalign: This attribute holds the alignment value of the numerator, possible values are left, right and center.

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

Example:



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
   
<head>
    <title>HTML5 MathML mfrac tag</title>
</head>
   
<body>
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
          
        <h3>HTML5 MathML <mfrac> tag</h3>
          
        <math>
            <mfrac bevelled="true">
                <mfrac>
                    <msup>
                        <mi>x</mi>
                        <mn>2</mn>
                    </msup>
                    <msup>
                        <mi>y</mi>
                        <mn>2</mn>
                    </msup>
                </mfrac>
                <mfrac>
                    <msup>
                        <mi>a</mi>
                        <mn>2</mn>
                    </msup>
                    <msup>
                        <mi>b</mi>
                        <mn>2</mn>
                    </msup>
                </mfrac>
            </mfrac>
        </math>
    </center>
</body>
   
</html>

chevron_right


Output:

Supported Browsers: The browsers supported by HTML5 MathML <mfrac> tag are listed below:

  • Firefox

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.