MyInternships.in

HTML5 MathML

HTML5 MathML voffset Attribute

The voffset attribute on the <mpadded> element shifts its content vertically. A positive value raises the content and a negative value lowers it, without altering the space it reports to the layout.


Definition and Usage

Use voffset to nudge a symbol up or down for fine visual tuning - aligning an accent, raising a term, or correcting an optical imbalance. It moves only the rendered content; combine it with width, height and depth to also change the reported box.

Syntax

Raising content by 0.3em
Example
<mpadded voffset="0.3em">
  <mi>x</mi>
</mpadded>

Example

This raises one term relative to its neighbours to show the shift.

Shifting a term upward
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML voffset attribute</title>
</head>
<body>
  <math display="block">
    <mrow>
      <mi>a</mi>
      <mo>+</mo>
      <mpadded voffset="0.4em">
        <mi>b</mi>
      </mpadded>
      <mo>+</mo>
      <mi>c</mi>
    </mrow>
  </math>
</body>
</html>
💡

voffset only affects display within <mpadded>. Use it for small optical corrections rather than large layout changes.

Key Takeaways

  • voffset shifts <mpadded> content vertically.
  • Positive values raise, negative values lower the content.
  • It changes rendering position, not the default reported box.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships