Baseline 2023
Newly available

Since January 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The MathML element is used to attach an arbitrary number of subscripts and superscripts to an expression at once, generalizing the element. Scripts can be either pre-scripts (placed before the expression) or post-scripts (placed after it).

MathML uses the syntax below, that is a base expression, followed by an arbitrary number of post-subscript and post-superscript pairs (attached in the given order) optionally followed by an element and an arbitrary number of pre-subscript and pre-superscript pairs (attached in the given order). In addition, empty elements can be used to represent absent scripts.

html

  base
  post-sub-script-1 post-sup-script-1
  post-sub-script-2 post-sup-script-2
  post-sub-script-3 post-sup-script-3
  ...
  post-sub-script-N post-sup-script-N
                      ⎫
  pre-sub-script-1 pre-sup-script-1  ⎪
  pre-sub-script-2 pre-sup-script-2  ⎬ Optional
  pre-sub-script-3 pre-sup-script-3  ⎪
  ...                                ⎪
  pre-sub-script-M pre-sup-script-N  ⎭

Attributes

This element's attributes include the global MathML attributes as well as the following deprecated attributes:

subscriptshift Deprecated Non-standard

A indicating the minimum amount to shift the baseline of the subscript down.

superscriptshift Deprecated Non-standard

A indicating the minimum amount to shift the baseline of the superscript up.

Note: For the subscriptshift and superscriptshift attributes, some browsers may also accept legacy MathML lengths.

Examples

Using

Children after the element are placed as pre-scripts (before the base expression):

html

  
    X 
    a 
    b 
    
    c 
    d 
  

Empty scripts

Empty elements can be used to represent absent scripts:

html

  
    X    
     
    b    
    
    c    
     
  

Order of scripts

Here is a more complex example with many scripts, so you can see in which order they are attached to the base:

html

  
    X 
    1 
    2 
    3 
    4 
    
    5 
    6 
    7 
    8 
  

Technical summary

Specifications

Specification
MathML Core
# prescripts-and-tensor-indices-mmultiscripts

Browser compatibility

See also

  • (Subscript)
  • (Superscript)
  • (Subscript-superscript pair)