Is there any difference between
<math display="inline"></math>
and
<math style="display: inline;"></math>?
Thanks!
Is there any difference between
<math display="inline"></math>
and
<math style="display: inline;"></math>?
Thanks!
On
No sir, they are exactly the same you can have a look on the Math tag documentation on Mozilla developer network here
While
display="inline"andstyle="display:inline"usually behave similarly, MathML'sdisplayattribute and CSS'sdisplayproperty are very different things.While both should affect the "external" layout (i.e., how the MathML expression fits into its surrounding context) similarly, they are ultimately unrelated and can interact in unexpected ways when clashing. This is perhaps not surprising since they are specified in completely different standards and their interaction is not specified anywhere; for some examples see the code snippet at the end. While SVG (the other XML language incorporated into HTML5) is seeing active development from both the SVG and the CSS Working Group to align, MathML is no longer under active development and thus won't be aligned with CSS in the future.
The important differences are probably the following:
MathML's attributes only has two values (
inlineandblock) whereas CSS offers a large variety ofdisplayattributes; this is primarily due to the fact that MathML is agnostic of its context (since it's an XML language). It means you'll often have to set both values which can lead to maintenance problems.MathML's
displayattribute affects the internal layout of an expression. This is because it affects MathML'sdisplaystyleattribute, causing, e.g., moveable limits to be typeset differently; see https://www.w3.org/Math/draft-spec/mathml.html#chapter2_interf.toplevel.atts for more information on that.In addition, the need for polyfills for MathML complicates matters further, as they may handle the interaction differently (as can be seen in the sample below when using the button to load MathJax). Since nothing is specified, there's no right or wrong here, of course.