How do I pass CSS into an Iframe?

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('https://mysite.com/site.css');</script>

Learn more about styling your forms in our Advanced CSS guide.