Using CSS with MathML

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

All the examples used in the previous section used HTML element and attribute names, for the purpose of illustration. However, you can use a CSS stylesheet to control the appearance of any type of XML document. All that is needed is to define appropriate style rules that refer to the element and attribute names used in that document. In particular, you can use CSS style rules to specify how MathML expressions should be rendered. Style rules for MathML and XHTML can then be combined in a single stylesheet that can be used, for example, to control the appearance of an XHTML document that contains embedded MathML equations.

Some examples of effects you can achieve with a custom CSS stylesheet, include the following:

  • Display all equations in a document in a different font size or color.
  • Choose a different scaling factor for the size of subscripts and superscripts.
  • Assign a different meaning to the big and small values of the mathsize attribute.
  • Associate a particular font family that contains the relevant glyphs with particular values of the mathvariant attribute.

In this section, we give some examples of CSS rules involving MathML presentation markup. These rules illustrate how you can use a CSS stylesheet to control specific aspects of the display of MathML.



<< back next >>





Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America