HTML5 MathML

HTML5 MathML selection Attribute

The selection attribute on <maction> chooses which of its child expressions is currently displayed, identified by a 1-based index.


Definition and usage

The selection attribute holds a positive integer that indexes the children of an <maction> element, starting at 1. It sets which child is shown; with actiontype="toggle", it also marks the starting point for cycling.

Which elements use it

  • <maction> - selects the displayed child by 1-based index.

Example

Showing the second child first
<math>
  <maction actiontype="toggle" selection="2">
    <mn>0.5</mn>
    <mfrac><mn>1</mn><mn>2</mn></mfrac>
  </maction>
</math>

With selection="2", the fraction (the second child) is displayed initially instead of the decimal.

⚠️

Because <maction> is not required by MathML Core, browsers typically just render the selected child and ignore any toggling; the selection value still determines what is shown.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships