Center Aligning a HTML Button in Wordpress

Viewed 86

I'm trying to center align a button in Wordpress using html. I know it's basic, but I'm a total noob.

Below is the code I'm trying to edit. Thanks for your help!

<div class="frm_submit">
    [if back_button]
        <button type="submit" name="frm_prev_page"
             formnovalidate="formnovalidate" class="frm_prev_page [back_hook]>
                 [back_label]
        </button>
    [/if back_button]

    <button class="frm_button_submit" type="submit"  [button_action]> 
        [button_label]
    </button>

    [if save_draft]
        <a href="#" tabindex="0" class="frm_save_draft" [draft_hook]> 
            [draft_label]
        </a>
    [/if save_draft]
</div>
1 Answers

You should be able to center your button by adding the following CSS

.frm_submit {
  text-align: center;
}

<button> elements have display: inline-block; on them by default, therefore it's possible to center them by adding the text-align: center; to the container.

Let me know if you need help on how to add the CSS to your website :)

Related