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.

            
              <h1 id="title">Favorite Things</h1>
<div id="form-outer">
  <p id="description">
    Show us what your favorite things are:
  </p>
  <form id="survey-form" method="GET" onsubmit=getInputElements()
        action="https://crossorigin.me/https://freecodecamp.com">
    <div class="rowTab">
      <div class="labels">
        <label id="name-label" for="name">* Name: </label>
      </div>
      <div class="rightTab">
        <input autofocus type="text" name="name" id="name" class="input-field" placeholder="Enter your name" required>
      </div>
    </div>
    <div class="rowTab">
      <div class="labels">
        <label id="email-label" for="email">* Email: </label>
      </div>
      <div class="rightTab">
        <input type="email" name="email" id="email" class="input-field" required placeholder="Enter your Email">
      </div>
    </div>
    <div class="rowTab">
      <div class="labels">
        <label id="number-label" for="age">* Age: </label>
      </div>
      <div class="rightTab">
        <input type="number" name="age" id="number" min="1" max="125" class="input-field" placeholder="Age">
      </div>
    </div>
    <div class="rowTab">
      <div class="labels">
        <label for="currentPos">Which option best describes your favorite after-school activity?</label>
      </div>
      <div class="rightTab">
        <select id="dropdown" name="currentPos" class="dropdown">
      <option disabled value>Select an option</option>
      <option  value="reading">Reading</option>
      <option value="sports">Sports</option>
      <option value="learner">Full Time Learner</option>
      <option value="preferNo">Arts and Crafts</option>
      <option value="other">Other</option>
    </select>
      </div>
    </div>
    <div class="rowTab">
      <div class="labels">
        <label for "what is their favorite food">*What is your favorite type of food?</label>
      </div>
      <div class="rightTab">
        <ul style="list-style: none;">
          <li class="radio">
            <label>Italian<input name="radio buttons" value="1" type="radio" class="userRatings" ></label></li>
          <li class="radio"><label>Chinese<input name="radio-buttons" value="2"  type="radio" class="userRatings" ></label></li>
         <li class="radio">
<label>American<input name="radio-buttons" value="3" type="radio"
class="userRatings" ></label></li>
          <li class="radio">
<label>Mexican<input name="radio-buttons" value="4" type="radio"
class="userRatings" ></label></li>
          <li class="radio">
<label>Indian<input name="radio-buttons" value="5" type="radio"
class="userRatings" ></label></li>
        </ul>
      </div>
    </div>
    <div class="rowTab"
  <div class="labels"
    <label for="most-like">What is your favorite color? </label>
    </div>
  <div class="rightTab">
       <select id="most-like"
name="mostLike" class="dropdown">
         <option disabled selected value>Select an option</option>
         <option
value="red">Red</option>
         <option
                 value="blue">Blue</option>
         <option
                 value="purple">Purple</option>
         <option
                 value="pink">Pink</option>
         <option
                 value="other">Other</option>
         </select>
      </div>
    </div>
    <div class="rowTab">
      <div class="labels">
        <label 
               for="preferences">What do you do in your free-time?<br>(Check all that apply):</label>
      </div>
      <div class="rightTab">
     <ul li="preferences" style="list-style:none;">
       <li class="checkbox"><label><input name="prefer" value="1" type="checkbox" class="userRatings">Watch TV</label></li>
       <li class="checkbox"><label><input name="prefer" value="2"
       type="checkbox"class="userRatings">Sleep</label></li>
       
       <li class="checkbox"><label>
         <input name="prefer" value="3" type="checkbox"class="userRatings">Read a good book</label></li>
       <li class="checkbox"><label>
         <input name="prefer"value="4" type="checkbox"class="userRatings">Go outside to play</label></li>
       
       <li class="checkbox"><label>
         <input name="prefer"value="5" type="checkbox"class="userRatings">Do a "serious" sport</label></li>
       
       <li class="checkbox"><label>
         <input
name="prefer"value="6"
         type="checkbox"class="userRatings">Relax on your couch</label></li>
                                          <li class="checkbox"><label>
         <input name="prefer"value="7" type="checkbox"class="userRatings">Play with your pet</label></li>
       
       <li class="checkbox"><label>
         <input name="prefer"value="8" type="checkbox"class="userRatings">Go shopping</label></li>
       
       <li class="checkbox"><label>
         <input name="prefer"value="9" type="checkbox"class="userRatings">Hang out with friends</label></li>
       
       <li class="checkbox"><label>
         <input name="prefer"value="10" type="checkbox"class="userRatings">Do some crafty activities</label></li>
              
       </ul>
      </div>
    </div>
    <div class="rowTab">
      <div class="labels">
        <label for="comments">Any Comments or Suggestions?</label>
      </div>
      <div class="rightTab">
        <textarea id="comments" class="input-field" style="height:50px;resize:vertical;" name="comment" placeholder="Enter your comment here..."></textarea>
      </div>
    </div>
    <button id="submit" type="submit">Submit</button>
  </form>
</div>
         
            
          
!
            
              @import
  url(https://fonts.googleapis.com/css?family=Raleway:400,500);

html,
body {
  background-color: #a9d7d1;
  text-align: center;
  font-family: 'Raleway', Helvetica, sans-serif;
  min-width: 320px;
}

header {
  font-size: 2em;
  font-weight: bold;
  margin: 20px;
}

#form-outer {
  background-color: #a9d7d1;
  margin: 0 auto;
  border-radius: 4px;
  width: 75%;
  max-width: 900px;
  padding: 10px;
  padding-top: 20px;
}

.labels {
  display: inline-block;
  text-align: right;
  width: 40%;
  padding: 5px;
  vertical-align: top;
  margin-top: 10px;
}

.rightTab {
  display: inline-block;
  text-align: left;
  width: 48%;
  vertical-align: middle;
}

.input-field {
  height: 20px;
  width: 280px;
  padding: 5px;
  margin: 10px;
  border: 1px solid #c0c0c0;
  border-radius: 2px;
}

#userAge {
  width: 40px;
}

.userRatings,
input[type="checkbox"] {
  float: left;
  margin-right: 5px;
}

#submit {
  background-color: black;
  border-radius: 4px;
  color: white;
  font-size: 1em;
  height: 40px;
  width: 96px;
  margin: 10px;
  border: 0px solid;
}

.dropdown {
  height: 35px;
  width: 140px;
  padding: 5px;
  margin: 10px;  
  margin-top: 15px;
  border: 1px solid #c0c0c0;
  border-radius: 2px;
}

.radio, .checkbox {
  position: relative;
  left: -43px;
  margin-left: 10px;
  display: block;
  padding-bottom: 10px;
}

@media screen and (max-width: 833px) {
  .input-field {
    width: 80%;
  }
  select {
    width: 90%;
  }
}

@media screen and (max-width: 520px) {
  .labels {
    width: 100%;
    text-align: left;
  }
  .rightTab {
    width: 80%;
    float: left;
  }
  .input-field {
    width: 100%;
  }
  select {
    width: 100%;
  }
}

            
          
!
            
              
const projectName = 'survey-form';
function getInputElements()
{
  var myForm = document.getElementById("survey-form"); 
  var completeText = "This is what you filled in. \n"
  
  for(var i = 0; i < myForm.elements.length; i++)
  {
      completeText = completeText + " " + myForm.elements[i].name + " :" +       myForm.elements[i].value + " \n"

  }; 

    window.alert(completeText);

}; 



  
            
          
!
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