google-forms-css

Style Google Forms with Bootstrap or CSS

About

This library let’s you embed a Google Form in a web page and style it with Bootstrap or CSS.

There are a number of tutorials on the web that show you how to code your own HTML form and link it to a Google Form. This library does it for you.

Google Forms google-forms-css
Before After
Demo: Google Forms google-forms-css

What works:

What doesn’t work:

*You can still collect email addresses, you just need to uncheck Settings > Collect email addresses and add your own email address question.

Requirements

Instructions

  1. Create a new Google Form
  1. Upload the google-forms-css folder to your web server

  2. Include jQuery in the <head> of your page (if it isn’t already):

  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  1. Include Bootstrap in the <head> of your page (if it isn’t already):
  <link href="//stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">

Tip: You can use Isolated Bootstrap instead if you only want to style the form, not your entire page:

  <link href="//toert.github.io/Isolated-Bootstrap/versions/4.1.0/iso_bootstrap4.1.0min.css" rel="stylesheet">

Alternatively, you can skip Bootstrap and style the form yourself by targeting Bootstrap class names with CSS.

  1. Add this code in the <body> of your page, replacing the formURL with your own:
  <div class="bootstrap" id="google-forms-css">

    <!-- loading -->
    <div id="google-forms-css-loading">
      <p>Loading…</p>
    </div>

    <div id="google-forms-css-main" style="display: none;">

      <!-- header -->
      <p>Please fill out the form below.</p>
      <p class="text-danger">* Required</p>

      <form id="google-forms-css-form"></form>

      <!-- footer -->
      <p><a href="privacy-policy.html">Privacy Policy</a></p>

    </div>

    <!-- confirmation -->
    <div id="google-forms-css-confirmation" style="display: none;">
      <p>Thanks!</p>
    </div>

  </div>

  <script src="google-forms-css/google-forms-css.js"></script>
  <script>

  new googleFormsCSS({
    formURL: 'https://docs.google.com/forms/d/e/1FAIpQLSeMO__7rzu_gS8Yurq9ai3z99rQeS0xe_rzkzYa7vYdu4Ea8g/viewform',
    // confirmationURL: 'confirmation.html', // optional
    // placeholderText: 'Your answer', // optional
  });

  </script>
  1. Give it a whirl!

Tips

Feedback

Feedback and suggestions welcome!