- MathML Tutorial
- MathML - Home
- MathML - Overview
- MathML - All Elements
- MathML - Basic Elements
- MathML - Carries
- MathML - Enclosing
- MathML - Fencing
- MathML - Fractions
- MathML - Long Division
- MathML - Matrices
- MathML - Multiplication
- MathML - Overscript
- MathML - Padding
- MathML - Phantom
- MathML - Radicals
- MathML - Repeating Decimals
- MathML - Style
- MathML - Subscripts
- MathML - Subscript-Superscript
- MathML - Superscripts
- MathML - Underscript
- MathML - Underscript-Overscript
- MathML Symbols
- MathML - Algebra Symbols
- MathML - Calculus Symbols
- MathML - Ellipses Symbols
- MathML - Function Symbols
- MathML - Geometry Symbols
- MathML - Greek Letters
- MathML - Invisible Operators
- MathML - Logic Symbols
- MathML - Set Symbols
- MathML Useful Resources
- MathML - Quick Guide
- MathML - Useful Resources
- MathML - Discussion
MathML - Fractions
<mfrac> tag is used to draw fractions.
Syntax
Here is the simple syntax to use this tag −
<mfrac> numerator denominator </mfrac>
Parameters
Here is the description of all the parameters of this tag −
numerator − numerator of the fraction.
denominator − denominator of the fraction.
Attributes
Here is the description of all the attributes of this tag −
linethickness − to specify the stroke width of the fraction bar. values are measured in px, pt, em etc.
numalign − to specify alignment of numerator. values are left, right or center.
denomalign − to specify alignment of denominator. values are left, right or center.
bevelled − to specify whether the fraction should be displayed vertically or inline. values are true or false.
Example
Let's draw a simple fraction for 1/x.
<math xmlns = "http://www.w3.org/1998/Math/MathML"> <mfrac> <mn>1</mn> <mi>x</mi> </mfrac> </math>
Output
Let's build a complex fraction.
<math xmlns = "http://www.w3.org/1998/Math/MathML"> <mfrac linethickness = '3px'> <mfrac bevelled = 'true'> <mn>1</mn> <mi>x</mi> </mfrac> <mrow> <mi>y</mi> <mo>-</mo> <mn>2</mn> </mrow> </mfrac> </math>
Output
Advertisements