Search code examples
javascripthtmlcssforms

How Can I Center My Forms Button?


I'm using a Cognito Form and it works well, the only thing that irritates me is that the "submit" button won't center. I've tried , that simply made the text boxes above it centered, while the submit button was still on the left hand side. I don't see very many other options for this. https://gyazo.com/bd4a143cefe2a0f764a82bd922f92e6f

<div class="cognito">
<script src="https://services.cognitoforms.com/s/kQtsv-uYpE2Bbu47xu3lPw">    </script>
<script>Cognito.load("forms", { id: "1" });</script></span>
</div>

Solution

  • You can add below script just before end of span tag.

    <script type="text/javascript">
        window.onload = function() {
            document.querySelector(".cognito .c-action").style="text-align: center;float:none;";
        };
        </script>