Home / Admin / How to Center a Form
Duplicate Snippet

Embed Snippet on Your Site

How to Center a Form

This code centers the form using margin: 0 auto and sets a maximum width of 500px.

10+
Code Preview
css
.wpforms-container.wpf-center {
    margin: 0 auto !important;
    /* Adjust the width in the next 2 lines as your site needs */
    max-width: 500px !important;
    width: 500px !important;
}
/* Readjust the form width for smaller devices */
@media only screen and (max-width: 600px) {
    .wpforms-container.wpf-center {
        /* Reset the width for devices under 600px */
        max-width: unset !important;
        width: auto !important;
    }
}

Comments

Add a Comment