JSFiddle - React, Tailwind, and code Playground

by zono

HTML

<fieldset>
   <legend>Text</legend>
   <div>
       text text text
   </div>
</fieldset>

JavaScript

/**
 * @author Georgi Naumov
 * [email protected] for contacts and suggestions
 * http://georgi-naumov.blogspot.com/
 */
(function() {
    window.addEventListener("load", function centerLegend() {
        var legends = document.getElementsByTagName("legend");
        for(var i = 0 ; i < legends.length ; i++) {
            legends[i].setAttribute("align", "center");
        }

        window.removeEventListener("load", centerLegend);
    });
})();