<!DOCTYPE html>
<style>
div {
  width: 20px;
  padding: 5px;
  font-size: 40px;
  overflow-x: scroll;
  overflow-y: hidden;
}
</style>
<div>
  <math display="block" style="width: min-content;">
    <mn>text</mn>
  </math>
</div>
<div style="direction: rtl;">
  <math display="block" style="width: min-content;">
    <mn>text</mn>
  </math>
</div>
