123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              

<div id="form-title">
      <h1 id="title">What&rsquo;s your brand?</h1>
      <p id="description">Tell us your vision and values and we&rsquo;ll help you create a brand identity that makes people stop and take notice.</p>
    </div>

<!-- One "tab" for each step in the form: -->
<div class="tab">
    <h2>Ok, first thing&rsquo;s first. What&rsquo;s your contact info?</h2>
      <p id="directions">(fields marked with a * are required)</p>
    <div class="form-field" id="form-field-1">
        <label id="name-label" for="name">*Name:</label>
        <input autofocus type="text" id="name" name="name" class="input-field" placeholder="Jane Doe" required oninput="this.className = ''">
    </div>
    <div class="form-field" id="form-field-2">
        <label id="email-label" for="email">*Email:</label> 
        <input type="email" id="email" name="email" class="input-field" placeholder="jane@janedoe.com" oninput="this.className = ''" required>
    </div>
    <div class="form-field" id="form-field-3">
        <label id="number-label" name="number">Phone Number:</label>
        <input type="number" id="number" name="number" class="input-field" placeholder="123-456-7890" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" min="0" max="10" oninput="this.className = ''">
    </div>
</div>

<div class="tab">
    <h2>Great! Now let&rsquo;s talk about your brand</h2>
    <div class="form-field" id="form-field-4">
        <label id="dropdown-label" for="dropdown">What are you branding?</label>
        <select id="dropdown" name="dropdown" class="dropdown" onchange="this.className=''">
          <option disabled option>Select an option:</option>
          <option value="company">Company</option>
          <option value="product">Product</option>
          <option value="service">Service</option>
        </select>
    </div>
    <div class="form-field" id="form-field-5">
        <p id="radio-label">If your brand was a person, what word would best describe it?</p>
        <div class="radio-field">
          <input type="radio" name="brand-personality" value="sincere" onclick="this.className=''">
          <label for="sincere">Sincere</label>
        </div>
        <div class="radio-field">
          <input type="radio" name="brand-personality" value="exciting" onclick="this.className=''">
          <label for="exciting">Exciting</label>
        </div>
         <div class="radio-field">
          <input type="radio" name="brand-personality" value="competent" onclick="this.className=''">
          <label for="competent">Competent</label>
        </div>
        <div class="radio-field">
          <input type="radio" name="brand-personality" value="sophisticated" onclick="this.className=''">
          <label for="sophisticated">Sophisticated</label>
        </div>
    </div>
    <div class="form-field" id="form-field-6">
        <p id="check-label">Which design style would best fit your brand?</p>
        <div class="check-field">
          <input type="checkbox" name="design-style" value="techy" onclick="this.className=''">
          <legend for="techy">Techy</legend>
        </div>
        <div class="check-field">
          <input type="checkbox" name="design-style" value="illustrative" onclick="this.className=''">
          <legend for="illustrative">Illustrative</legend>
        </div>
        <div class="check-field">
          <input type="checkbox" name="design-style" value="product-based" onclick="this.className=''">
          <legend for="product-based">Product Based</legend>
        </div>
        <div class="check-field">
          <input type="checkbox" name="design-style" value="flashy" onclick="this.className=''">
          <legend for="flashy">Flashy</legend>
        </div>
        <div class="check-field">
          <input type="checkbox" name="design-style" value="photo-based" onclick="this.className=''">
          <legend for="photo-based">Photography Based</legend>
        </div>
        <div class="check-field">
          <input type="checkbox" name="design-style" value="minimalistic" onclick="this.className=''">
          <legend for="minimalistic">Minimalistic</legend>
        </div>
    </div>
</div>

<div class="tab">
    <h2>Almost done! Is there anything you&rsquo;d like to add?</h2>
    <textarea id="comments" class="input-field" name="comment" placeholder="Type your comments here&hellip;"></textarea>
    <button id="submit" type="submit">Finished!</button>
</div>

<div id="prev-next-area">
  <div id="prev-next-container">
    <button type="button" id="prevBtn" onclick="nextPrev(-1)">Previous</button>
    <button type="button" id="nextBtn" onclick="nextPrev(1)">Next</button>
  </div>
</div>

<!-- Circles which indicates the steps of the form: -->
<div id="breadcrumbs" >
  <span class="step"></span>
  <span class="step"></span>
  <span class="step"></span>
</div>

</form>
            
          
!
            
              
            #survey-form {
                background-color: #ffffff;
                opacity: 0.66;
                margin: 100px auto;
                padding: 40px;
                width: 70%;
                min-width: 300px;
            }
            h1,h2{
                font-family: 'Cardo', serif;
            }
            p, label,input{
                font-family: 'Lato', sans-serif;
            }
            #form-title{
                margin-bottom: 3em;
            }
            #form-title h1{
                text-align: center;
                font-size: 2.5em;
                margin-bottom: 0;
            }
            #form-title p{
                font-family: 'Cardo', serif;
                font-style: italic;
                font-size: 1.15em;
                text-align: center;
            }
            #directions{
                font-family: 'Cardo', serif;
                font-style: italic; 
            }
            
            .form-field{
                margin-top: 1.5em;
                display: flex;
                flex-direction: column;
                justify-content: flex-start;
            }
            
            label{
                margin-bottom: 1em;
            }
            
            input,
            #dropdown{
                padding: 10px;
                width: 66%;
                max-width: 300px;
                font-size: 17px;
                border: 1px solid #aaaaaa;
                font-family: 'Lato', sans-serif;
            }
            
            #dropdown-label,
            #radio-label,
            #check-label{
                font-weight: bold;
            }
            
            .radio-field{
                margin-bottom: 1em;
            }
            
            .radio-field input{
                width: 15px;
                height: 15px;
            }
            
            .check-field{
                display: flex;
                justify-content: flex-start;
                align-items: center;
                font-family: 'Lato', sans-serif;
                margin-bottom: 1em;
            }
            
            .check-field input{
                width: 15px;
                height: 15px;
            }
            
            textarea{
                width: 100%;
                height: 100px;
                margin-bottom: 1em;
                font-size: 17px;
                border: 1px solid #aaaaaa;
                font-family: 'Lato', sans-serif
            }
            
            

            /* Mark input boxes that gets an error on validation: */

            input.invalid {
                background-color: #ffdddd;
            }

            input.valid{
                background-color: #009000;
            }

            /* Hide all steps by default: */
            
            .tab {
                display: none;
            }
            

            /* Make circles that indicate the steps of the form: */
            .step {
                height: 15px;
                width: 15px;
                margin: 0 2px;
                background-color: #39220B;
                border: none; 
                border-radius: 50%;
                display: inline-block;
                opacity: 0.5;
            }

            /* Mark the active step: */
            .step.active,
            .step.finish{
                opacity: 1;
            }
            
            button{
                width: 150px;
                height: 50px;
                border-radius: 5px;
                border: none;
                background-color: #000000;
                font-family: 'Lato', sans-serif;
                font-weight: bold;
                color: #ffffff;
                font-size: 1.5em;
                letter-spacing: 2px;
            }
            
            button:hover{
                opacity: 0.75;
            }
            
            #prev-next-area{
                overflow:auto;
            }
            
            #prevBtn{
                float: left;
            }
            
            #nextBtn,
            #submit{
                float:right;
            }
            
            #breadcrumbs{
                text-align:center;
                margin-top:40px;
            }
            
          
!
            
              var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab

function showTab(n) {
  // This function will display the specified tab of the form ...
  var x = document.getElementsByClassName("tab");
  x[n].style.display = "block";
  // ... and fix the Previous/Next buttons:
  if (n == 0) {
    document.getElementById("prevBtn").style.display = "none";
  } else {
    document.getElementById("prevBtn").style.display = "inline";
  }
  if (n == (x.length - 1)) {
    document.getElementById("nextBtn").style.display = "none";
  } else {
    document.getElementById("nextBtn").innerHTML = "Next";
  }
  // ... and run a function that displays the correct step indicator:
  fixStepIndicator(n)
}

function nextPrev(n) {
  // This function will figure out which tab to display
  var x = document.getElementsByClassName("tab");
  // Exit the function if any field in the current tab is invalid:
  if (n == 1 && !validateForm()) return false;
  // Hide the current tab:
  x[currentTab].style.display = "none";
  // Increase or decrease the current tab by 1:
  currentTab = currentTab + n;
  // if you have reached the end of the form... :
  if (currentTab >= x.length) {
    //...the form gets submitted:
    document.getElementById("survey-form").submit();
    return false;
  }
  // Otherwise, display the correct tab:
  showTab(currentTab);
}

function validateForm() {
  // This function deals with validation of the form fields
  var x, y, i, valid = true;
  x = document.getElementsByClassName("tab");
  y = x[currentTab].getElementsByTagName("input");
  // A loop that checks every input field in the current tab:
  for (i = 0; i < y.length; i++) {
    // If a field is empty...
    if (y[i].value == "") {
      // add an "invalid" class to the field:
      y[i].className += " invalid";
      // and set the current valid status to false:
      valid = false;
    }
  }
  // If the valid status is true, mark the step as finished and valid:
  if (valid) {
    document.getElementsByClassName("step")[currentTab].className += " finish";
  }
  return valid; // return the valid status
}

function fixStepIndicator(n) {
  // This function removes the "active" class of all steps...
  var i, x = document.getElementsByClassName("step");
  for (i = 0; i < x.length; i++) {
    x[i].className = x[i].className.replace(" active", "");
  }
  //... and adds the "active" class to the current step:
  x[n].className += " active";
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console