'fieldset legend position right not working in mPDF Laravel

I use niklasravnsborg/laravel-pdf with Laravel 8 to generate PDFs
in my Pdf page I puted a fieldset, I want to set legend in the right position, but it's not working, I tried align=aright, float=right , text-align=right but nothing ...
any helps ?



Solution 1:[1]

The legend of a fieldset is aligned with the margin. To place a legend at the right side of the fieldset you have to use: margin-left: auto because the value auto will consume all remaining space.

legend {
  margin-left: auto;
}
<fieldset>
  <legend>Legend</legend>
  Empty Fieldset for Testing
</fieldset>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tacoshy