How do I pass CSS into an Iframe in Cognito Forms V2?

The process for passing CSS into an Iframe is the same for both Cognito Forms V1 and V2. Begin with your form’s Iframe embed code, located in the Publish Code section of the Publish page. Then, choose one of the following options:

  • Option 1: Paste the code into your webpage’s HTML. Then, insert some additional script directly underneath the code to include your CSS: <script>Cognito.setCss('body { background-color: #ff0000; }');</script>
  • Option 2: Pass-in a URL for a stylesheet by inserting the address of your CSS file: <script>Cognito.setCss('');</script>