Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <meta name="viewport" content="width=device-width, initial-scale=1.0">

<div class="container">
  
<header>
  <h1 id="title">My food survey form</h1>
  <p id="description">This is a survey that asks people about their food preferences.</p>
</header>
  
 <form id="survey-form">
   <div class="form-group">
      <label for="name" id="name-label">Name</label><br>
      <input 
          class="form-control input-style"
          id="name" 
          type="text" 
          name="name" 
          placeholder="Enter your full name"                required
          /><br>
   </div>
   
   <div>
     <label for="email" id="email-label">Email</label><br>
     <input 
            id="email" 
            type="email" 
            name="email" 
            placeholder="Enter your email address"
            class="input-style"
            required
            /><br>
   </div>
   
   <div>
  <label for="number" id="number-label">Age<span>(optional)</span></label><br>
     <input class="input-style"
            id="number" 
            type="number" 
            name="number" 
            placeholder="Age"
            min="13"
            max="65"
            /><br>
   </div>
   
   <div>
     <label for="dropdown" id="dropdown-label">Which option best describes your favourite type of food</label><br>
     <select class="input-style" id="dropdown" name="favourite-food" required>
       <option disabled selected value>Select favourite food category</option>
       <option value="Vegetables">Vegetables</option>
       <option value="Fruits">Fruits</option>
       <option value="Grain,legumes,nuts and seeds">Grains, legumes, nuts and seeds</option>
       <option value="Meat and poultry">Meat and poultry</option>
       <option value="Fish and seafood">Fish and seafood</option>
       <option value="Dairy foods">Dairy foods</option>
       <option value="Eggs">Eggs</option>
       </select>
     </div>
   
   <div>
     <p>How often do you eat food from the above mentioned food group?</p>
    <label for="EveryDay">
      <input 
             id="EveryDay" 
             type="radio" 
             name="EatWeekly"
             value="Everyday"
             checked
             />Everyday<br>
      </label>
     
      <label for="2/3TimesPerWk">
      <input 
             id="2/3TimesPerWk" 
             type="radio" 
             name="EatWeekly"
             value="Every two or three days"
             />Every two or three days<br>
      </label>
     
      <label for="OnceWeekly">
      <input 
             id="OnceWeekly" 
             type="radio" 
             name="EatWeekly"
             value="Once a week"
             />Once a week<br>
      </label>
      </div>
   <div>
     <p>Which of the following best applies to you when eating out?</p>
    <select id="kind-food" name="food-preference" class="input-style">
      <option disabled selected value>Select the option that best describes you</option>
      <option>I only have starters and finger foods.</option>
      <option>I eat the main course and nothing else.</option>
      <option>Desert is the only thing I'm having</option>
      <option>There's nothing better than fullcourse meals!</option>
      <option>I don't eat out.</option>
      </select>
       </div>
     
     <div id="checkbox-div">
       <p>Which of the dishes from the list below do you like to eat? <span>(check all that apply)</span></p>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Pizza"
                />Pizza<br>
         </label>
       
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Ramen"
                />Ramen<br>
         </label>
       
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Sushi"
                />Sushi<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Peking duck"
                />Peking duck<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Lasagna"
                />Lasagna<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Salad"
                />Salad<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Ice-cream"
                />Ice-cream<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Kimchi"
                />Kimchi<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Fried chicken"
                />Fried chicken<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Fruit salad"
                />Fruit salad<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Hamburger"
                />Hamburger<br>
         </label>
       <label>
         <input 
                type="checkbox"
                name="liked-dishes"
                value="Biryani"
                />Biryani<br>
         </label>
     </div>
   
   <div>
     <p id="textarea-label">Are there any other dishes you would suggest?</p>
       <textarea class="form-control"
                 id="suggestions"
                 name="suggestion-block"
                 placeholder="Enter your suggestion here"
               
       ></textarea>
     </div>
   
   <div>
     <button type="submit" id="submit">
       Submit
       </button>
   </div>
   
   </form>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Gochi+Hand&family=Leckerli+One&display=swap');
body{
  background-image: url("https://media.istockphoto.com/vectors/vector-set-of-design-templates-and-elements-for-restaurant-and-food-vector-id1125926284?k=20&m=1125926284&s=612x612&w=0&h=boWvHoFXEEqLpwxGFC65V3i4vRuoOpVuBbYvBfvaZ-g=");
 background-attachment: fixed;
  
  margin:0;
  width: 100%;
  height: 100%;
  
 color: white;
  
}




Form{
  border: 2px groove #FFF;
  border-radius: 20px;
  font-family: Gochi Hand;
  font-size: 1.6rem;
  padding: 1rem;
  width: 100%;
  margin: auto;
  background-color: #FF5733;
}


header{
  font-family: Leckerli One;
  font-size: 2.6rem;
  color: #FF5733;
  text-align: center;
}

textarea{
  display: block;
  width: 80%;
  margin: auto;
  height: 100px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-family: Gochi Hand;
  font-size: 1.3rem;
  background-color: #0EDDE5;
}

.input-style{
  border-style: groove;
  border-color: #FF5733;
  border-radius: 50px;
  border-width: 3px;
  background-color:#BABBBB;
  font-family: Gochi Hand;
  font-size: 1.5rem;
  width: 100%;
  padding: auto;
  height: 40px;
  }

.container{
  max-width: 100%;
  margin: 2rem auto 0 auto;
}

@media (min-width: 480px){
  .container{
    max-width: 480px;
  }
}

@media (min-width: 720px){
  .container{
    max-width: 720px 
  }
}



#name-label,#email-label,#number-label,#dropdown-label{
  background-color:#FF5733;
  border-radius: 50px;
  padding: 0 10px 0 10px;
}

#textarea-label{
  text-align: center;
}

#submit{
  display: block;
  margin: auto;
  margin-bottom: 20px;
  font-family: Gochi Hand;
  font-size: 2rem;
  color: #FFF;
  width: 30%;
  border-style: none;
  border-radius: 5px;
  height: 60px;
  background-color: #0FDA58; 
  cursor: pointer;
}

#description{
  background-color: #0EDDE5;
  border: 10px groove #FF5733;
  border-radius: 50px;
  border-width: 1vw;
  padding: 10px;
}

#checkbox-div{
  background-color: #FF5733;
  border-radius: 20px;
  padding: 5px 0 5px 15px;
  margin-top: 20px;
}
              
            
!

JS

              
                // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place. 

/***********
INSTRUCTIONS:
  - Select the project you would 
    like to complete from the dropdown 
    menu.
  - Click the "RUN TESTS" button to
    run the tests against the blank 
    pen.
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!
    ************/

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments. 

              
            
!
999px

Console