---
title: How to Style HubSpot Forms in the New Form Editor (v4)
description: Why your CSS doesn't reach forms from HubSpot's new form editor, and how to style them with the raw HTML embed, --hsf-* CSS variables and .hsfc-* classes.
image: https://www.pixtheme.com/hubfs/hubspot%20v4%20forms.jpeg
---

[Skip to content](https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4#main-content)

[![Pixtheme](https://www.pixtheme.com/hubfs/pixtheme-agency-demo/pixtheme-logo-light.svg)](https://www.pixtheme.com/)

- [Services](https://www.pixtheme.com/services)
  
  Show submenu for Services
  
    - [Hire a HubSpot developer](https://www.pixtheme.com/hire-hubspot-developer)
    - [HubSpot CMS website development New HubSpot websites your team can edit without a developer.](https://www.pixtheme.com/services/hubspot-cms-development)
    - [HubSpot Website Redesign A fresh design for your HubSpot site, built on what already works.](https://www.pixtheme.com/services/hubspot-website-redesign)
    - [WordPress to HubSpot migration Pages, blog posts and redirects moved over with care.](https://www.pixtheme.com/services/wordpress-to-hubspot-migration)
    - [Custom HubSpot modules and integrations Custom modules, apps and integrations for your portal.](https://www.pixtheme.com/services/hubspot-custom-modules)
  [View all Services](https://www.pixtheme.com/services) 
  
  [Themes and modules Ready-made HubSpot modules Calculators, countdowns, testimonials and more, built for the HubSpot Marketplace. Browse modules](https://www.pixtheme.com/themes-and-modules)
- [Assets New](https://www.pixtheme.com/themes-and-modules)
- [About Us](https://www.pixtheme.com/about)
- [Contact Us](https://www.pixtheme.com/contact-us)

[Book a call (opens in a new tab)](https://www.pixtheme.com/meetings/gotohubspot)

[Book a call (opens in a new tab)](https://www.pixtheme.com/meetings/gotohubspot)

[All posts](https://www.pixtheme.com/blog) / [HubSpot Development](https://www.pixtheme.com/blog/tag/hubspot-development)

# How to Style HubSpot Forms in the New Form Editor (v4)

[![](https://www.pixtheme.com/hs-fs/hubfs/mexu-event-demo/photos/marcus-hale.jpg?width=44&height=44&name=marcus-hale.jpg) Rafayel Sh.](https://www.pixtheme.com/blog/author/rafayel-sh) October 26, 2026 4 min read

![HubSpot v4 forms](https://www.pixtheme.com/hs-fs/hubfs/hubspot%20v4%20forms.jpeg?width=1600&height=900&name=hubspot%20v4%20forms.jpeg)

Share

<https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.pixtheme.com%2Fblog%2Fhow-to-style-hubspot-forms-in-the-new-form-editor-v4> <https://x.com/intent/post?url=https%3A%2F%2Fwww.pixtheme.com%2Fblog%2Fhow-to-style-hubspot-forms-in-the-new-form-editor-v4&text=%3Cspan+id%3D%22hs_cos_wrapper_name%22+class%3D%22hs_cos_wrapper+hs_cos_wrapper_meta_field+hs_cos_wrapper_type_text%22+style%3D%22%22+data-hs-cos-general-type%3D%22meta_field%22+data-hs-cos-type%3D%22text%22+%3EHow+to+Style+HubSpot+Forms+in+the+New+Form+Editor+%28v4%29%3C%2Fspan%3E> <https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.pixtheme.com%2Fblog%2Fhow-to-style-hubspot-forms-in-the-new-form-editor-v4>

Forms built in HubSpot's **new form editor** are embedded in an **iframe** by default, so your page CSS can't reach them. To style them with your own CSS, use HubSpot's **raw HTML (developer) embed**, which renders the form directly in the page, then style it with the `--hsf-*` CSS variables and `.hsfc-*` classes.

We ran into this while building the lead form for our [Smart Calculator](https://assets.pixtheme.com/modules/smart-calculator-demo) HubSpot module, which has to match whatever theme it's placed in. This tutorial shows the approach that worked, with the code.

## Why your CSS stopped working

Forms from the legacy form editor render straight into the page, so CSS like `.hs-form input { ... }` styles them. Forms from the new editor are different: the standard embed, and HubSpot's ``

`` tag in themes, output a placeholder element with the class `hs-form-frame`, and HubSpot's script loads the form inside an iframe. An iframe is a separate document, so selectors on your page don't apply inside it.

You have three options, from simplest to most flexible.

## Option 1: Use the form editor's style settings

The new form editor has its own style options for fonts, colors, buttons and field shapes. If you only need the form to roughly match your brand, set them there. It needs no code, but you can't match a theme exactly, and every form has to be styled one by one.

## Option 2: Use the raw HTML embed and style it with CSS

HubSpot also offers a developer embed that renders the form as normal HTML in your page. It looks like this:

```
<div class="hs-form-html"
     data-region="na1"
     data-form-id="YOUR-FORM-ID"
     data-portal-id="YOUR-PORTAL-ID"></div>

<script src="https://js.hsforms.net/forms/embed/developer/YOUR-PORTAL-ID.js" defer></script>
```

Notes:

- Use the region your portal lives in. For portals outside `na1` the script host includes the region, for example `js-eu1.hsforms.net`.
- Load the script once per page, even if the page has several forms.
- You can find the form ID in the form editor's URL or embed code.

### Style it with CSS variables

The rendered form reads its styles from CSS custom properties that start with `--hsf-`. Set them on the form's renderer element and the whole form follows:

```
.my-form [data-hsfc-id="Renderer"],
.my-form .hsfc-Renderer {
  --hsf-global__font-family: inherit;
  --hsf-global__color: #1f2933;
  --hsf-background__background-color: transparent;
  --hsf-background__padding: 0;
  --hsf-field-label__color: #111417;
  --hsf-field-label__font-size: 0.875rem;
  --hsf-field-input__background-color: #ffffff;
  --hsf-field-input__border-color: #d5dbe1;
  --hsf-field-input__border-radius: 10px;
  --hsf-field-input__placeholder-color: #8f9aa4;
  --hsf-button__background-color: #fe5900;
  --hsf-button__color: #ffffff;
  --hsf-button__border-radius: 12px;
  --hsf-button__width: 100%;
  --hsf-erroralert__color: #ef4444;
  --hsf-row__vertical-spacing: 1rem;
}
```

Pointing these variables at your theme's own variables, for example `var(--brand-primary)`, makes every form follow your theme automatically.

### Fine-tune with .hsfc-\* classes

For anything the variables don't cover, the rendered elements have stable class names starting with `hsfc-`, such as `.hsfc-FieldLabel`, `.hsfc-TextInput`, `.hsfc-Button`, `.hsfc-RichText` and `.hsfc-Step__Content`. Scope your rules to a wrapper so they don't leak:

```
.my-form .hsfc-RichText p { margin: 0 0 0.5rem; }
.my-form .hsfc-Button { font-weight: 600; letter-spacing: 0.01em; }
```

## Option 3: Inside a HubSpot module, swap the iframe embed automatically

In a theme or module, editors pick a form with a form field and the ``

`` tag renders the iframe version. In our Smart Calculator module we render that output inside a `<template>`, read the form and portal IDs from it, and replace it with the raw HTML embed in the browser. Legacy forms, which don't produce an `hs-form-frame`, are left as they are:

```
<div class="my-form">
  <template data-form-src>

</template>
  <script>
    (function (tpl) {
      var frame = tpl.content.querySelector(".hs-form-frame");
      if (!frame) { tpl.replaceWith(document.importNode(tpl.content, true)); return; }
      var box = document.createElement("div");
      box.className = "hs-form-html";
      ["data-region", "data-form-id", "data-portal-id", "data-env"].forEach(function (a) {
        if (frame.getAttribute(a)) box.setAttribute(a, frame.getAttribute(a));
      });
      tpl.replaceWith(box);
      if (!document.querySelector("script[data-hsf-dev]")) {
        var region = frame.getAttribute("data-region");
        var s = document.createElement("script");
        s.src = "https://js" + (region && region !== "na1" ? "-" + region : "") +
                ".hsforms.net/forms/embed/developer/" + frame.getAttribute("data-portal-id") + ".js";
        s.defer = true;
        s.setAttribute("data-hsf-dev", "");
        document.head.appendChild(s);
      }
    })(document.currentScript.previousElementSibling);
  </script>
</div>
```

This simplified version skips one detail: if you also insert a legacy form this way, its own scripts need to be re-run, because scripts inside a `<template>` don't execute when moved.

## Gotchas we hit

- **Legacy forms behave differently.** Forms from the old editor still render with the classic `.hs-form` markup and don't use `--hsf-*` variables, so keep your old CSS for them.
- **Field names changed.** In the new forms, inputs are named with an object prefix, for example `0-1/email` for a contact property. Update any JavaScript that finds fields by name.
- **The form appears after the script loads.** Reserve some height on the wrapper to avoid layout shift while it renders.
- **Don't load the developer script twice.** Check for an existing script tag before adding one, as in the example above.
- **Test the submit flow**, including the thank-you message or redirect, after switching embeds.

## Frequently asked questions

### Can I style a HubSpot form inside an iframe with CSS?

Not from your page's stylesheet. Use the form editor's style settings, or switch to the raw HTML embed so the form is part of your page.

### Does the raw HTML embed still create contacts in HubSpot?

Yes. It is HubSpot's own embed, so submissions, contact creation and form analytics work as with the standard embed.

### Do these CSS variables work on legacy forms?

No. The `--hsf-*` variables and `.hsfc-*` classes belong to forms from the new editor.

## Need forms that match your theme everywhere?

We build [custom HubSpot modules](https://www.pixtheme.com/services/hubspot-custom-modules) and themes where forms, calculators and lead capture follow your brand automatically. If your forms don't look right, [hire a HubSpot developer](https://www.pixtheme.com/hire-hubspot-developer) from our team to fix them.

- [HubSpot Development](https://www.pixtheme.com/blog/tag/hubspot-development)

## Keep reading

[All posts](https://www.pixtheme.com/blog)

- [![](https://www.pixtheme.com/hs-fs/hubfs/HubSpot%20developer%20cost.png?width=800&height=500&name=HubSpot%20developer%20cost.png)](https://www.pixtheme.com/blog/how-much-does-it-cost-to-hire-a-hubspot-developer)
  
  Hiring Oct 24, 2026
  
  ### [How Much Does It Cost to Hire a HubSpot Developer?](https://www.pixtheme.com/blog/how-much-does-it-cost-to-hire-a-hubspot-developer)
  
  Read
- [![](https://www.pixtheme.com/hs-fs/hubfs/Benefits%20of%20the%20HubSpot%20CMS.png?width=800&height=500&name=Benefits%20of%20the%20HubSpot%20CMS.png)](https://www.pixtheme.com/blog/what-are-benefits-of-the-hubspot-cms)
  
  business Aug 28, 2017
  
  ### [What Are the Benefits of the HubSpot CMS? 11 Reasons Teams Switch](https://www.pixtheme.com/blog/what-are-benefits-of-the-hubspot-cms)
  
  Read

Work with us

## Need help with your HubSpot site?

Book a free consultation with a HubSpot developer. We look at your site and give you a fixed-price plan.

[Book a free consultation](https://meetings.hubspot.com/gotohubspot) [Our services](https://www.pixtheme.com/services)

Fixed prices · Replies within one business day

[![pixtheme Hubspot development agency](https://www.pixtheme.com/hs-fs/hubfs/pix%20new%20orange%20(3)-1.png?width=143&height=36&name=pix%20new%20orange%20(3)-1.png)](https://www.pixtheme.com/)

HubSpot websites, themes, modules and custom apps - designed, built and shipped by a team that only does HubSpot.

- [LinkedIn](https://www.linkedin.com/company/pixtheme/)

## Services

- [HubSpot CMS Website Development](https://www.pixtheme.com/services/hubspot-cms-development)
- [HubSpot Website Redesign](https://www.pixtheme.com/services/hubspot-website-redesign)
- [WordPress to HubSpot Migration](https://www.pixtheme.com/services/wordpress-to-hubspot-migration)
- [Custom HubSpot Modules & Integrations](https://www.pixtheme.com/services/hubspot-custom-modules)
- [Hire a HubSpot Developer](https://www.pixtheme.com/hire-hubspot-developer)

## Company

- [About Us](https://www.pixtheme.com/about)
- [Contact Us](https://www.pixtheme.com/contact-us)
- [Blog](https://www.pixtheme.com/blog)

## Start a project

- Remote-first · Working with teams worldwide
- [hello@pixtheme.com](mailto:hello@pixtheme.com)

©  Pixtheme. Built on HubSpot, obviously.

- [Terms](https://www.pixtheme.com/terms-condition)
- [Privacy Policy](https://www.pixtheme.com/privacy-policy)

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.pixtheme.com/#organization",
  "@type" : "Organization",
  "description" : "HubSpot development studio building HubSpot CMS websites, custom modules, integrations and HubSpot Marketplace themes.",
  "email" : "hello@pixtheme.com",
  "image" : "https://3428146.fs1.hubspotusercontent-na1.net/hubfs/3428146/pixtheme-agency-demo/pixtheme-share-1200x630.png",
  "logo" : {
    "@type" : "ImageObject",
    "height" : 512,
    "url" : "https://3428146.fs1.hubspotusercontent-na1.net/hubfs/3428146/pixtheme-agency-demo/pixtheme-logo-512.png",
    "width" : 512
  },
  "name" : "Pixtheme",
  "sameAs" : [ "https://www.linkedin.com/company/pixtheme/", "https://www.upwork.com/freelancers/~01a324dfdc750cc718", "https://ecosystem.hubspot.com/marketplace/solutions/pixtheme" ],
  "url" : "https://www.pixtheme.com/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.pixtheme.com/#website",
  "@type" : "WebSite",
  "name" : "Pixtheme",
  "publisher" : {
    "@id" : "https://www.pixtheme.com/#organization"
  },
  "url" : "https://www.pixtheme.com/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4#breadcrumb",
  "@type" : "BreadcrumbList",
  "itemListElement" : [ {
    "@type" : "ListItem",
    "item" : "https://www.pixtheme.com/",
    "name" : "Home",
    "position" : 1
  }, {
    "@type" : "ListItem",
    "item" : "https://www.pixtheme.com/blog",
    "name" : "Blog",
    "position" : 2
  }, {
    "@type" : "ListItem",
    "item" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4",
    "name" : "How to Style HubSpot Forms in the New Form Editor (v4)",
    "position" : 3
  } ]
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4#webpage",
  "@type" : "WebPage",
  "about" : {
    "@id" : "https://www.pixtheme.com/#organization"
  },
  "breadcrumb" : {
    "@id" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4#breadcrumb"
  },
  "description" : "Why your CSS doesn't reach forms from HubSpot's new form editor, and how to style them with the raw HTML embed, --hsf-* CSS variables and .hsfc-* classes.",
  "isPartOf" : {
    "@id" : "https://www.pixtheme.com/#website"
  },
  "name" : "How to Style HubSpot Forms in the New Form Editor (v4)",
  "url" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4#article",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Rafayel Sh."
  },
  "dateModified" : "2026-10-26T19:59:59Z",
  "datePublished" : "2026-10-26T19:59:59Z",
  "description" : "Why your CSS doesn't reach forms from HubSpot's new form editor, and how to style them with the raw HTML embed, --hsf-* CSS variables and .hsfc-* classes.",
  "headline" : "How to Style HubSpot Forms in the New Form Editor (v4)",
  "image" : "https://3428146.fs1.hubspotusercontent-na1.net/hubfs/3428146/hubspot%20v4%20forms.jpeg",
  "mainEntityOfPage" : {
    "@id" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4#webpage"
  },
  "publisher" : {
    "@id" : "https://www.pixtheme.com/#organization"
  },
  "url" : "https://www.pixtheme.com/blog/how-to-style-hubspot-forms-in-the-new-form-editor-v4"
}
```