files/en-us/web/mathml/reference/element/mpadded/index.md
The <mpadded> MathML element is used to add extra padding and to set the general adjustment of position and size of enclosed contents.
This element's attributes include the global MathML attributes as well as the following attributes:
depth
<mpadded> element.height
<mpadded> element.lspace
<mpadded> element.voffset
<mpadded> element.width
<mpadded> element.For the depth, height, lspace, voffset and width attributes, some browsers may instead accept a more complex syntax:
+ or - sign as a prefix, specifying an increment or decrement to the corresponding dimension (if absent, the corresponding dimension is set directly to specified value).<unsigned-number> (let's call it α below).width, height or depth. The specified value is interpreted as α times the corresponding dimension of the content.width, height or depth. The specified value is interpreted as α% the corresponding dimension of the content.<math display="block">
<mpadded width="400px" height="5em" depth="4em" lspace="300px" voffset="-2em">
<mi>x</mi>
<mo>+</mo>
<mi>y</mi>
</mpadded>
</math>
mpadded {
background: lightblue;
}
{{ EmbedLiveSample('dimensions_and_offsets_example', 700, 200, "", "") }}
<math display="block">
<!-- increment by a length -->
<mpadded width="+20px">
<mtext>+20px</mtext>
</mpadded>
<!-- set to a pseudo-unit -->
<mpadded width="2width">
<mtext>2width</mtext>
</mpadded>
<!-- increment by a percent of a pseudo-unit -->
<mpadded width="+400%height">
<mtext>+400%height</mtext>
</mpadded>
<!-- decrement to a multiple of a namedspace -->
<mpadded width="-1thickmathspace">
<mtext>-1thickmathspace</mtext>
</mpadded>
</math>
mpadded:nth-child(1) {
background: lightblue;
}
mpadded:nth-child(2) {
background: lightgreen;
}
mpadded:nth-child(3) {
background: lightyellow;
}
mpadded:nth-child(4) {
background: pink;
}
{{ EmbedLiveSample('legacy_syntax_example', 700, 200, "", "") }}
{{Specifications}}
{{Compat}}