Style Contact Form 7 with CSS, by asking

CMSHands, a free WordPress plugin, adds a chat to your dashboard. Type “Make my contact form match the rest of the site.” See the new form first; one-click undo.

Block themes only. It styles the form; it doesn't build new forms. How to tell

Block themes only. It styles the form; it doesn't build new forms. How to tell

Contact Form 7 is a trademark of its owner. CMSHands is not affiliated with it.

CMSHandsmysite.com

Works on sites hosted at

Watch it do this on a real site

You ask

1 of 6

Make my contact form match the rest of the site.

Make my contact form match the rest of the site.

  1. Looking for what you meant
  2. Listing your plugins and themes
  3. Looking at your theme’s colours and sizes
  4. Reading one of your pages
  5. Reading a file on your site
  6. Preparing the new styles for your OK
  7. Previewing the change
Style Contact form fields and button
Waiting for you
The waiting card with After pressed: the contact form with full-width rounded fields, a dark Submit, then Add the styles
The waiting card with After pressed: the contact form with full-width rounded fields, a dark Submit, then Add the styles
  1. /* CMSHands: Contact form fields and button */
  2. .wpcf7 input.wpcf7-form-control:not([type="submit"]),
  3. .wpcf7 textarea.wpcf7-form-control {
  4. background-color: var(--wp--preset--color--base-2);
  5. border: 1px solid var(--wp--preset--color--contrast-3);
  6. border-radius: .33rem;
  7. box-sizing: border-box;
  8. color: var(--wp--preset--color--contrast);
  9. font-family: inherit;
  10. font-size: var(--wp--preset--font-size--medium);
  11. padding: .6rem .75rem;
  12. width: 100%;
  13. }
  14. .wpcf7 input.wpcf7-form-control:focus,
  15. .wpcf7 textarea.wpcf7-form-control:focus {
  16. border-color: var(--wp--preset--color--contrast);
  17. outline: 2px solid var(--wp--preset--color--contrast);
  18. outline-offset: 1px;
  19. }
  20. .wpcf7 input.wpcf7-submit {
  21. background-color: var(--wp--preset--color--contrast);
  22. border: 1px solid var(--wp--preset--color--contrast);
  23. border-radius: .33rem;
  24. color: var(--wp--preset--color--base);
  25. cursor: pointer;
  26. font-family: inherit;
  27. font-size: var(--wp--preset--font-size--small);
  28. font-weight: 500;
  29. padding: .6rem 1rem;
  30. }
  31. .wpcf7 input.wpcf7-submit:hover,
  32. .wpcf7 input.wpcf7-submit:focus {
  33. background-color: var(--wp--preset--color--contrast-2);
  34. border-color: var(--wp--preset--color--contrast-2);
  35. color: var(--wp--preset--color--base);
  36. }
  37. .wpcf7 label {
  38. color: var(--wp--preset--color--contrast);
  39. font-size: var(--wp--preset--font-size--small);
  40. }
The card with Code pressed: the CSS it would add in green, every rule starting with .wpcf7 and the theme's colors

Styling Contact form fields and button

Add the stylesNot nowCan be undone

I'll find your contact form and see what's in it.

Ready for you to review — the fields and the Submit button now use the same colours, corner rounding and text sizes as the rest of the site's buttons and forms.

Make my contact form match the rest of the site.

Style Contact form fields and button
Waiting for you
The waiting card with After pressed: the contact form with full-width rounded fields, a dark Submit, then Add the styles
The waiting card with After pressed: the contact form with full-width rounded fields, a dark Submit, then Add the styles
  1. /* CMSHands: Contact form fields and button */
  2. .wpcf7 input.wpcf7-form-control:not([type="submit"]),
  3. .wpcf7 textarea.wpcf7-form-control {
  4. background-color: var(--wp--preset--color--base-2);
  5. border: 1px solid var(--wp--preset--color--contrast-3);
  6. border-radius: .33rem;
  7. box-sizing: border-box;
  8. color: var(--wp--preset--color--contrast);
  9. font-family: inherit;
  10. font-size: var(--wp--preset--font-size--medium);
  11. padding: .6rem .75rem;
  12. width: 100%;
  13. }
  14. .wpcf7 input.wpcf7-form-control:focus,
  15. .wpcf7 textarea.wpcf7-form-control:focus {
  16. border-color: var(--wp--preset--color--contrast);
  17. outline: 2px solid var(--wp--preset--color--contrast);
  18. outline-offset: 1px;
  19. }
  20. .wpcf7 input.wpcf7-submit {
  21. background-color: var(--wp--preset--color--contrast);
  22. border: 1px solid var(--wp--preset--color--contrast);
  23. border-radius: .33rem;
  24. color: var(--wp--preset--color--base);
  25. cursor: pointer;
  26. font-family: inherit;
  27. font-size: var(--wp--preset--font-size--small);
  28. font-weight: 500;
  29. padding: .6rem 1rem;
  30. }
  31. .wpcf7 input.wpcf7-submit:hover,
  32. .wpcf7 input.wpcf7-submit:focus {
  33. background-color: var(--wp--preset--color--contrast-2);
  34. border-color: var(--wp--preset--color--contrast-2);
  35. color: var(--wp--preset--color--base);
  36. }
  37. .wpcf7 label {
  38. color: var(--wp--preset--color--contrast);
  39. font-size: var(--wp--preset--font-size--small);
  40. }
The card with Code pressed: the CSS it would add in green, every rule starting with .wpcf7 and the theme's colors

Styling Contact form fields and button

Add the stylesNot nowCan be undone
  1. Adding styles to your site
  2. Checking the change
Style Contact form fields and buttonApproved
Approved

Done. I checked afterwards, and the change is in place.

UndoCan be undone
The live contact form before, with narrow plain boxes, and right after, with full-width rounded fields in the theme's colors
  1. Reverting the change
  2. Checking the change

Undone. I checked afterwards, and it's back the way it was.

A real run on our test site, Quillmoor Pottery (WP 7.1.3, Twenty Twenty-Four), . From asking to done, it took 50 seconds.

  • It adds CSS, the rules that set how your site looks, to style your Contact Form 7 forms and nothing else, on a block theme.
  • You see the form before and after, on a computer and a phone, before anything changes.
  • On an older (classic) theme it writes the CSS for you to paste.

Do this on your own site

That's the whole job. The plugin is free: 3 changes to try it, no account. Nothing changes until you press the button, and an undo within 24 hours gives the change back.

Download the free plugin

Get the plugin here instead

How to style Contact Form 7 with CSS in WordPress yourself

In WordPress, open Appearance › Editor › Styles › Additional CSS, add rules that start with div.wpcf7 for the fields and the button, then save.

Checked on WP 7.1,

  1. 1. In your dashboard, go to Appearance › Editor. Choose Styles, open the ⋮ (More) menu and choose Additional CSS.

    The Styles panel in Appearance › Editor, its ⋮ (More) menu open and Additional CSS outlined
  2. 2. Contact Form 7 puts every form in a box, written div.wpcf7 in CSS. Start each rule with it and it touches only your forms.

    The test site's Contact page: the box Contact Form 7 puts around the form outlined, its fields still plain
  3. 3. For the fields, add: div.wpcf7 input.wpcf7-text, div.wpcf7 textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #958d86; border-radius: 6px; font: inherit; }

    Show the picture
    Additional CSS with the field rules typed at the end of the box, under the line that was already there
  4. 4. For the button, add: div.wpcf7 input.wpcf7-submit { background-color: #65574e; color: #ffffff; font: inherit; border: 0; border-radius: 100px; padding: 12px 32px; }

    Show the picture
    The same box with the button rule added under the field rules: the brown #65574e and round corners
  5. 5. Put your own colors in place of #958d86, the border, and #65574e, the button. Press Review 1 change… at the bottom left, then Save.

    Show the picture
    The Review changes window after Review 1 change…: Custom Styles ticked and Save outlined
  6. 6. Open your form's page in a new tab and on your phone. Press Submit with a required field empty to check the error still shows.

    Show the picture
    The live Contact page after Save: full-width rounded fields and a brown, round Submit like the site's other buttons

On an older (classic) theme, the kind with Appearance › Customize instead of Editor, the same rules go in Appearance › Customize › Additional CSS. Press Publish to keep them. CMSHands can't add them there; it writes the CSS in the chat and tells you where to paste it.

Contact Form 7 leaves the look of its fields to your theme, so on many themes they show up as small, plain browser boxes. Your rules live in your site's styles, not in the plugin, so a Contact Form 7 update leaves them alone. Switching themes does drop them: each theme keeps its own Additional CSS. The two colors above are our test site's own gray and brown, the brown of its other buttons. A color code is # and six letters or digits.

Or ask for it in the chat

“Make my contact form match the rest of the site.”

Download the free plugin

Get the plugin here instead

Why it won't wreck your site

  • Nothing changes until you press the button. Every change comes as a card that names it. Nothing happens until you press the button or Not now.
  • You see it first. Old words in red, new words in green. For layout, before-and-after pictures on a computer and a phone.
  • One click undoes it. When something can't be undone, like deleting a page or a plugin, the card says so before you press.

Where CMSHands stops

  • Older (classic) themesOn a theme with Appearance › Customize instead of Editor, it can't add the CSS itself. It writes the rules for you to paste there.
  • An exact match with your other buttonsIt uses your theme's colors and sizes. In our run, the Submit came out near-black, while the site's other buttons are brown and round. Check the After picture first.
  • Building or changing the formIt changes how the form looks, not what it asks. New fields, the emails it sends and where messages go stay in Contact › Contact Forms.
  • Other form pluginsWe've run it on Contact Form 7 only. We haven't tested other form plugins yet.
  • Fonts, pictures and scriptsPlain CSS only, with the fonts your theme already has. No pictures, and no JavaScript, the code that makes a page react when you click.

More it can do

Same chat, same OK button, on your own site.
  • Header and footer:

    Keep your header on screen

    “Make my header stay at the top of the screen when people scroll.”

    It took 2 minutes 9 seconds on our test site.
  • Header and footer:

    Change your footer

    “Add our opening hours to the footer: Tue–Sat, 10am to 5pm.”

    It took 39 seconds on our test site.
  • Words and pages:

    Add a page

    “Add a page called Classes: Saturday classes, 10am, $45, book by email.”

    It took 12 seconds on our test site.

Questions about Contact Form 7 styling

Where do I add custom CSS for Contact Form 7?

In your site's Additional CSS, not in the plugin's own files, which an update would overwrite. On a block theme it's under Appearance › Editor › Styles, then the ⋮ menu. On an older theme it's Appearance › Customize › Additional CSS. Start each rule with div.wpcf7, the box around every form, so it touches only your forms.

How do I change the Contact Form 7 button color?

Give its submit button a rule of its own: div.wpcf7 input.wpcf7-submit { background-color: #65574e; color: #ffffff; } with your colors in place of ours. To change it when someone points at it, add a second rule for div.wpcf7 input.wpcf7-submit:hover with a darker color.

How do I style one Contact Form 7 form and not the others?

Give that form a class of its own. In the Contact Form 7 block, open Form attributes in the sidebar and type booking under Class. In a shortcode, add html_class="booking", like [contact-form-7 id="9" html_class="booking"], keeping your form's own id. Then start those rules with form.booking instead of div.wpcf7. Your other forms keep their look.

Why isn't my Contact Form 7 CSS working?

Most often your theme's rule for fields wins over yours. Make yours more specific: div.wpcf7 input.wpcf7-text beats a plain input rule. Check the spelling, clear any cache plugin, then reload the page. Switched themes lately? Paste the CSS again, since each theme keeps its own Additional CSS.

Will it work with my theme?

On a block theme it adds the CSS itself: your dashboard shows Appearance › Editor. How to tell. On an older (classic) theme it writes the CSS in the chat and tells you where to paste it: Appearance › Customize › Additional CSS.

Is it free to restyle my form with CMSHands?

To start, yes: 3 changes with no account, then 10 a month once you add your email. Questions are free, up to 30 a day.

Written by the CMSHands team. First published .

Try it on your own contact form

  1. 1. Download the plugin.A free zip file
  2. 2. Upload and activate it.Plugins › Add Plugin › Upload Plugin
  3. 3. Give CMSHands a task.Press Start working, then ask in your words
Download the free plugin

Get the plugin here instead

Works best on WP 6.3 or newer with PHP 8.0 or newer. What works on older sites

Download the free plugin