1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is Mozilla MathML Project.
16 * The Initial Developer of the Original Code is
17 * The University Of Queensland.
18 * Portions created by the Initial Developer are Copyright (C) 1999
19 * the Initial Developer. All Rights Reserved.
22 * Roger B. Sidje <rbs@maths.uq.edu.au>
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 /**************************************************************************/
40 /* namespace for MathML elements */
41 /**************************************************************************/
43 @namespace url
(http://www
.w3
.org
/1998/Math
/MathML
);
45 /**************************************************************************/
46 /* <math> - outermost math element */
47 /* Put Cambria before Cambria Math as Cambria Math has neither bold nor */
49 /**************************************************************************/
57 font-family: STIXGeneral
, DejaVu Serif
, DejaVu Sans
, Cambria
, Cambria Math
, Times
, Lucida Sans Unicode
, OpenSymbol
, Standard Symbols L
, serif
;
58 text-rendering: optimizeLegibility
;
59 -moz-float-edge: margin-box
;
61 math
[mode
="display"], math
[display
="block"] {
63 text-align: -moz-center
;
65 math
[display
="inline"] {
72 /**************************************************************************/
73 /* Style switching during frame construction depending on the context of <mi>:
74 These rules are not used when mathvariant or fontstyle is specified
76 /**************************************************************************/
78 /* If the textual content of an <mi> consists of a single character
79 with a corresponding mathematical italic alphanumeric character,
80 then try to emulate that character */
81 [-moz-math-font-style="italic"] {
85 /* If the textual content consists of multiple characters, then the default is
86 mathvariant=normal. It seems that mathvariant=normal should be interpreted
89 http://www.w3.org/TR/2003/REC-MathML2-20031021/chapter3.html#presm.commatt
91 "In particular, inheritance of the mathvariant attribute does not follow
92 the CSS model. The default value for this attribute is "normal"
93 (non-slanted) for all tokens except mi. ... (The deprecated fontslant
94 attribute also behaves this way.)"
96 [-moz-math-font-style="normal"] {
99 /* A style-invariant character preserves its own style */
100 [-moz-math-font-style="invariant"] {
105 /**************************************************************************/
106 /* attributes common to all tags */
107 /**************************************************************************/
109 /* deprecated attributes from MathML 1.0 */
112 [fontstyle="normal"] {
115 [fontstyle="italic"] {
119 [fontweight="normal"] {
122 [fontweight="bold"] {
126 /* attributes from MathML 2.0 */
128 /* These ones are handled in the back-end:
129 mathcolor (replaces 'color'):
130 #rgb | #rrggbb | html-color-name
131 mathbackground (replaces 'background'):
132 #rgb | #rrggbb | html-color-name
134 /* mathvariant (replaces 'fontstyle' & 'fontweight' & 'fontslant'):
135 normal | bold | italic | bold-italic | double-struck | bold-fraktur | script |
136 bold-script | fraktur | sans-serif | bold-sans-serif | sans-serif-italic |
137 sans-serif-bold-italic | monospace
139 Note1: Back-end code for these is not yet written (bug 114365):
140 double-struck, script, fraktur, bold-fraktur, bold-script
142 Note2: Don't use the 'font' shorthand because it resets the font-size and this
143 breaks the propagation of the scriptlevel size.
145 XXX bugs 46622 & 114365: need -moz-math-serif, etc, to only lookup math fonts
147 The meaning of mathvariant=normal is unclear as there is no interpretation
148 that "corresponds to SMP Math Alphanumeric Symbol characters"
149 (http://www.w3.org/TR/2003/REC-MathML2-20031021/chapter3.html#presm.commatt),
150 but let's assume an explicit mathvariant=normal is an attempt to reset all
153 [mathvariant] { /* shared and same as [mathvariant="normal"] */
154 /* reset all font properties except those that affect the size */
156 font-variant: normal;
159 [mathvariant="bold-fraktur"],
160 [mathvariant="bold-script"] {
163 [mathvariant="bold"] {
166 [mathvariant="italic"] {
169 [mathvariant="bold-italic"] {
173 [mathvariant="sans-serif"] {
174 font-family: sans-serif;
176 [mathvariant="bold-sans-serif"] {
178 font-family: sans-serif;
180 [mathvariant="sans-serif-italic"] {
181 font-family: sans-serif;
184 [mathvariant="sans-serif-bold-italic"] {
185 font-family: sans-serif;
189 [mathvariant="monospace"] {
190 font-family: monospace;
193 /**************************************************************************/
194 /* tags with generated content */
195 /**************************************************************************/
204 content: close-quote;
209 font-family: sans-serif;
218 background-color: lightyellow;
221 /**************************************************************************/
222 /* mtable and its related tags */
223 /**************************************************************************/
226 display: inline-table;
227 border-collapse: separate;
231 mtable[frame="none"] {
234 mtable[frame="solid"] {
237 mtable[frame="dashed"] {
243 vertical-align: baseline;
248 vertical-align: inherit;
249 text-align: -moz-center;
253 /* Don't support mtr without mtable, nor mtd without mtr */
256 display: none !important;
259 /***********************/
260 /* -- mtd: columnalign */
262 mtd[-moz-math-columnalign="left"],
263 mtd[columnalign="left"] {
266 mtd[-moz-math-columnalign="right"],
267 mtd[columnalign="right"] {
270 mtd[-moz-math-columnalign="center"],
271 mtd[columnalign="center"] {
272 text-align: -moz-center;
275 /*************************/
276 /* -- mtr, mtd: rowalign */
278 mtr[-moz-math-rowalign="top"],
280 mtd[rowalign="top"] {
283 mtr[-moz-math-rowalign="bottom"],
284 mtr[rowalign="bottom"],
285 mtd[rowalign="bottom"] {
286 vertical-align: bottom;
288 mtr[-moz-math-rowalign="center"],
289 mtr[rowalign="center"],
290 mtd[rowalign="center"] {
291 vertical-align: middle;
293 mtr[-moz-math-rowalign="baseline"],
294 mtr[rowalign="baseline"],
295 mtd[rowalign="baseline"] {
296 vertical-align: baseline;
298 /* -- not yet supported --
299 mtr[-moz-math-rowalign="axis"],
300 mtr[rowalign="axis"],
301 mtd[rowalign="axis"] {
302 vertical-align: mathline;
306 /**********************************************************************/
307 /* rules to achieve the default spacing between cells. The back-end code
308 will set the internal attributes depending on the cell's position.
309 These rules are hard-coded, the comments indicate what would be
310 desirable if the style data could be changed on the fly to pick
311 the values that users may set with the attributes of <mtable> */
313 padding-right: 0.4em; /* half of columnspacing[colindex] */
314 padding-left: 0.4em; /* half of columnspacing[colindex-1] */
315 padding-bottom: 0.5ex; /* half of rowspacing[rowindex] */
316 padding-top: 0.5ex; /* half of rowspacing[rowindex-1] */
318 /* turn off the spacing at the periphery of boundary cells */
319 mtr:first-child > mtd {
322 mtr:last-child > mtd {
331 /* re-instate the spacing if the table has a surrounding frame */
332 mtable[frame="solid"] > mtr:first-child > mtd,
333 mtable[frame="dashed"] > mtr:first-child > mtd {
334 padding-top: 0.5ex; /* framespacing.top */
336 mtable[frame="solid"] > mtr:last-child > mtd,
337 mtable[frame="dashed"] > mtr:last-child > mtd {
338 padding-bottom: 0.5ex; /* framespacing.bottom */
340 mtable[frame="solid"] > mtr > mtd:first-child,
341 mtable[frame="dashed"] > mtr > mtd:first-child {
342 padding-left: 0.4em; /* framespacing.left */
344 mtable[frame="solid"] > mtr > mtd:last-child,
345 mtable[frame="dashed"] > mtr > mtd:last-child {
346 padding-right: 0.4em; /* framespacing.right */
349 /**********************************************************************/
350 /* internal settings to support 'rowlines' and 'columnlines'. To
351 achieve the recommended behavior, the back-end code will avoid setting
352 unsuitable rules on the cells on the first row and the first column.
353 In general, however, authors can use the 'border' property of CSS to
354 achieve varying effects down to the level of the table cell. */
355 mtr[-moz-math-rowline="none"] > mtd {
358 mtr[-moz-math-rowline="solid"] > mtd {
359 border-top: solid thin;
361 mtr[-moz-math-rowline="dashed"] > mtd {
362 border-top: dashed thin;
364 mtd[-moz-math-columnline="none"] {
367 mtd[-moz-math-columnline="solid"] {
368 border-left: solid thin;
370 mtd[-moz-math-columnline="dashed"] {
371 border-left: dashed thin;
375 /**************************************************************************/
376 /* Style used for stretchy symbols *must* be normal to avoid misaligments */
377 /* By leaving the font-family empty, the MathML engine will use the value
378 provided by the mathfont-family property in the mathfont.properties file
379 or the value of the user's pref("font.mathfont-family", "...").
381 Authors can make elements on a document to be stretched with different
384 To request the use of TeX fonts, you can add a <style>...</style> with:
385 <mo myfonts="tex">...</mo> with the associated CSS declaration
386 mo[myfonts="tex"]::-moz-math-stretchy {
387 font-family: CMSY10, CMEX10;
390 To request the use of Mathematica fonts, you can add a <style>...</style> with:
391 <mo myfonts="mathematica">...</mo> with the associated CSS declaration
392 mo[myfonts="mathematica"]::-moz-math-stretchy {
393 font-family: Math1, Math2, Math4;
396 Of course, if you just want all of the stretchy characters in your
397 document to be stretched with your preferred list, you can just do:
398 ::-moz-math-stretchy {
399 font-family: [your-particular-list]
402 Note that like other fonts in the document, users can override this by
403 clicking the pref to override document fonts.
404 /**************************************************************************/
406 ::-moz-math-stretchy {
408 font-family: serif; /* an empty family is ignored as an error and behaves like inherit */
409 /* background-color: #3C6; */
411 ::-moz-math-anonymous {
414 /**********************************************************************/
415 /* Hide embedded semantic MathML content (as opposed to presentational
416 content, which we render). Ideally, here is the behavior that we want:
418 if there is an annotation-xml[encoding="MathML-Presentation"]
419 render that annotation, and ignore the first child of the
420 <semantics> element and all other annotations,
422 render the first child of <semantics> and ignore all annotations
424 But this cannot be expressed with CSS. As a stop-gap, just render
425 the first child to cater for most of the common cases - bug 154931.
427 semantics > :not(:first-child) {
431 /**********************************************************************/
432 /* This is used when wrapping non-MathML inline elements inside math. */
433 *|*::-moz-mathml-anonymous-block {
434 display: inline-block !important;
435 position: static !important;
439 /*****************************************/
440 /* Controlling scriptlevel */
441 /*****************************************/
443 /* mfrac, munder, mover and munderover change the scriptlevels of their children using
444 -moz-math-increment-script-level because regular CSS rules are insufficient to
445 control when the scriptlevel should be incremented */
446 :-moz-math-increment-script-level { -moz-script-level:+1; }
448 /* all other cases can be described using regular CSS, so we do it this way because it's
449 more efficient and less code */
450 mroot > :not(:first-child) { -moz-script-level:+2; }
452 msub > :not(:first-child),
453 msup > :not(:first-child),
454 msubsup > :not(:first-child),
455 mmultiscripts > :not(:first-child) { -moz-script-level:+1; }