Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Plugin how-tos · Guide

How to Style Contact Form 7 (Step by Step)

How to Style Contact Form 7 (Step by Step)

Short answer

Contact Form 7 has no style editor, so you style it with CSS in Additional CSS or a child theme. Target its classes, such as wpcf7-form for the form, wpcf7-form-control for fields and wpcf7-submit for the button, or add your own classes to form tags.

Key takeaways

  • Contact Form 7 inherits theme styles and has no visual editor.
  • Add CSS in Additional CSS or a child theme, never the plugin files.
  • wpcf7-form, wpcf7-form-control and wpcf7-submit cover most needs.
  • Form state classes let you colour success and error messages.
  • Custom class options target one form or field.
  • Use CSS grid in the template for side-by-side fields.

How do you style Contact Form 7?

You style Contact Form 7 with CSS, targeting its built-in classes such as wpcf7-form and wpcf7-submit, or your own classes, and adding the rules in Additional CSS.

Contact Form 7 ships with almost no design of its own. Your forms take on your theme's styles, which is why they often look plain or out of place.

The plugin does not have a visual style editor. Instead, it gives every part of the form a predictable CSS class, so you can style it with a few lines of code.

That sounds technical, but most changes need only simple rules: borders, padding, colours and a better button.

This guide shows where to add CSS, which classes to target and ready-made examples you can adjust. If you have not built a form yet, start with our guide on how to use Contact Form 7.

Where do you add CSS for Contact Form 7?

Add your CSS in Appearance, then Customize, then Additional CSS on classic themes, or in the Site Editor's Additional CSS panel on block themes, or in a child theme stylesheet.

Choose one place and keep all your form styles there.

PlaceBest forSurvives theme updates?
Customizer Additional CSSClassic themes, quick editsYes, stored per theme
Site Editor Additional CSSBlock themesYes, stored per theme
Child theme style.cssDevelopers, version controlYes
Code snippet pluginSites that switch themes oftenYes

For classic themes, open Appearance, then Customize, then Additional CSS. Changes preview live before you publish.

For block themes, open Appearance, then Editor, then Styles. Open the styles menu and choose Additional CSS.

Avoid editing the plugin's own CSS file. Plugin updates replace it and wipe out your changes.

Which CSS classes does Contact Form 7 use?

Contact Form 7 wraps the form in a div with the wpcf7 class, gives the form the wpcf7-form class, and adds wpcf7-form-control plus a type class to every field.

These are the classes you will use most.

ElementClass
Outer wrapper.wpcf7
Form element.wpcf7-form
Every field.wpcf7-form-control
Text, email, textarea.wpcf7-text, .wpcf7-email, .wpcf7-textarea
Submit button.wpcf7-submit
Field error message.wpcf7-not-valid-tip
Field with an error.wpcf7-not-valid
Result message box.wpcf7-response-output

The form also gets a class that shows its state, such as sent, invalid or failed. You can use those to colour the result message.

Contact Form 7's own guide to styling contact forms lists the classes and explains its markup.

To check classes on your own site, right-click a field and choose Inspect. Developer tools show the exact markup and classes.

How do you style the text fields?

Target the input and textarea controls inside wpcf7-form, then set width, padding, border, radius and font size so they match your design.

Here is a clean starting point.

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 16px;
  background: #fff;
  box-sizing: border-box;
}

.wpcf7-form textarea {
  min-height: 140px;
}

A font size of at least 16 pixels stops some mobile browsers from zooming in when a visitor taps a field.

Add a clear focus style, so keyboard users can see where they are.

.wpcf7-form .wpcf7-form-control:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-color: #2563eb;
}

MDN explains the difference between focus styles in its page on :focus-visible.

How do you style the submit button?

Target the wpcf7-submit class and give the button a background colour, text colour, padding, rounded corners and a hover state.

.wpcf7-form .wpcf7-submit {
  background: #2563eb;
  color: #fff;
  border: 0;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.wpcf7-form .wpcf7-submit:hover {
  background: #1d4ed8;
}

Check the contrast between text and background. The WCAG contrast guidance recommends a ratio of at least 4.5 to 1 for normal text.

If your theme overrides the button, make the selector a little more specific rather than adding important flags everywhere.

Contact Form 7 also shows a small spinner next to the button while the form sends. You can target it with the wpcf7-spinner class to change its colour or spacing.

Keep the button label short and clear, such as Send message. Visitors should know exactly what happens when they click it.

How do you style labels, errors and messages?

Style labels with a block display and spacing, error tips with a red colour and small font, and the response box with colours that match each form state.

.wpcf7-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 16px;
}

.wpcf7-not-valid-tip {
  color: #b91c1c;
  font-size: 14px;
  margin-top: 4px;
}

.wpcf7-form .wpcf7-not-valid {
  border-color: #b91c1c;
}

.wpcf7 form.sent .wpcf7-response-output {
  border-color: #15803d;
  background: #f0fdf4;
}

.wpcf7 form.invalid .wpcf7-response-output {
  border-color: #b45309;
  background: #fffbeb;
}

Wrapping each field inside its label in the form template makes the whole label clickable and helps screen readers. It also keeps spacing simple.

Keep error messages close to the field they describe. Visitors on long forms should not have to scroll to find what went wrong.

Avoid using colour alone to show an error. A red border plus a short text message works for people who cannot tell colours apart.

How do you add your own classes and IDs?

Add class and id options inside a form tag, such as class:my-field, or add an html_class attribute to the shortcode to target one form without affecting others.

Custom classes let you style one form differently from another.

In the form template, add options to any tag:

[text* your-name class:name-field placeholder "Your name"]
[submit class:big-button "Send message"]

To style a whole form, add a class to the shortcode:

[contact-form-7 id="123" title="Contact" html_class="contact-card"]

Then target it in CSS with .contact-card. The form tag syntax page lists every option you can add.

How do you put fields side by side?

Wrap the fields in div elements inside the form template and use CSS grid on the wrapper, so two fields sit in one row on desktop and stack on mobile.

The form template accepts plain HTML, so you can add your own layout markup.

<div class="cf7-row">
  <label>Name [text* your-name]</label>
  <label>Email [email* your-email]</label>
</div>
<label>Message [textarea your-message]</label>
[submit "Send"]

Then add this CSS:

.cf7-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .cf7-row {
    grid-template-columns: 1fr;
  }
}

MDN's guide to CSS grid layout explains how columns and gaps work.

How do you style checkboxes, radio buttons and dropdowns?

Target the list items inside wpcf7-checkbox and wpcf7-radio for spacing, and style select elements like text inputs, keeping native controls for accessibility.

.wpcf7-checkbox .wpcf7-list-item,
.wpcf7-radio .wpcf7-list-item {
  display: block;
  margin: 0 0 8px;
}

.wpcf7-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

Adding use_label_element to a checkbox or radio tag wraps each option in a label, making it easier to click.

If checkboxes disappear entirely, a theme rule is probably hiding them. Our guide on checkboxes not appearing in Contact Form 7 explains the fix.

How do you make the form look good on phones?

Keep fields full width, use comfortable tap sizes, stack any side-by-side rows below about 600 pixels and test the form on a real phone before you publish.

Most contact form visits come from mobile devices, so small screens deserve as much care as desktop.

A few simple rules help:

  • Full width fields. Set inputs and textareas to 100 percent width so they never overflow.
  • Large tap targets. Give the submit button enough padding to be at least 44 pixels tall.
  • Readable text. Keep field text at 16 pixels or more.
  • Clear spacing. Leave room between fields so visitors do not tap the wrong one.
  • Short forms. Remove optional fields you do not really need.

Then open the page on a phone, fill every field and submit a test message. Watch for the keyboard covering the button or error tips pushing the layout around.

Browser developer tools also have a device mode for quick checks. Use it while you adjust CSS, then confirm on a real device at the end.

Why are your styles not showing?

Styles usually fail because a theme rule is more specific, the CSS is cached or minified, or the selector does not match the markup, so inspect the element and clear caches.

Work through these checks:

  • Specificity. Inspect the field. If your rule is crossed out, add a parent class such as .wpcf7-form to your selector.
  • Caching. Purge your caching plugin and CDN, then reload in a private window.
  • Wrong selector. Compare your class names with the real markup in developer tools.
  • Page builders. Builders like Elementor can add their own form styles. See our guide on Contact Form 7 not showing in Elementor for builder issues.

Use important flags only as a last resort. They make later changes harder.

Is there a way to style Contact Form 7 without code?

Yes, styling plugins and some page builder widgets add visual controls for Contact Form 7, but they add weight, so plain CSS stays the lightest option.

Several add-on plugins offer colour pickers and spacing controls for Contact Form 7. Page builder add-ons often include a Contact Form 7 widget with style tabs.

These work well if you avoid CSS. The trade-off is another plugin to update and extra code on every page.

If you want a form plugin with built-in styling controls, our comparison of Contact Form 7 vs WPForms covers how each handles design. The core plugin is on WordPress.org if you need to check its current version.

Frequently asked questions

Does Contact Form 7 have built-in styling options?

No. Contact Form 7 focuses on form logic and leaves design to your theme. You style it with CSS using the classes the plugin adds to each element, or with an add-on plugin that provides visual controls.

Where should I put CSS for Contact Form 7?

Use the Additional CSS panel in the Customizer on classic themes, or in the Site Editor's styles on block themes. A child theme stylesheet or a code snippet plugin also works. Never edit the plugin's own files, since updates overwrite them.

How do I style only one Contact Form 7 form?

Add an html_class attribute to that form's shortcode, then use that class in your CSS selectors. Styles scoped to the class affect only that form and leave other forms on the site unchanged.

Why do my Contact Form 7 styles not apply?

Your theme may use more specific selectors, or a cache may still serve old CSS. Inspect the field in developer tools, make your selector more specific, then purge your caching plugin and CDN and reload in a private window.

How do I make Contact Form 7 fields appear side by side?

Wrap the fields in a div inside the form template, then apply CSS grid with two columns to that div. Add a media query that switches to one column on small screens so the form stays easy to use on phones.

Sources

  1. Styling contact form Contact Form 7
  2. Form-tag syntax Contact Form 7
  3. Contact Form 7 WordPress.org
  4. CSS grid layout MDN Web Docs
  5. Understanding contrast (minimum) W3C WAI

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.