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

              
                
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Beta Survey Form</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
     <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="freeCodeCamp survey form project" />
  </head>
  <body>
    <h1 id="title">Survey Form</h1>
    <p id="description">Please fill out this short survey</p>
    <form id="survey-form" action='https://register-demo.freecodecamp.org' method='post'>
       <fieldset>
         <label for='name' id='name-label'>Name: <input placeholder='Enter your name...' type='text' name="name" id='name' required autofocus/></label>
         <label for='email' id='email-label'>Email: <input placeholder='Enter your email...' type='email' name='email' id='email' pattern='^[0-9a-z-A-Z]+@[0-9a-z-A-Z]+(.com|.net)$' required/></label>
         <label for='number' id='number-label'>Age: <input placeholder='Enter your age...' type="number" name="age" id="number" min='13' max='120'/></label>
       </fieldset>
       <fieldset>
         <select id='dropdown'>
             <option value='0'>Select Account type:</option>
             <option value="1">Business</option>
             <option value="2">Personal</option>
             <option value='3'>Charity</option>
         </select>
       </fieldset>
      <fieldset>
        <label for='male' class='center-gender'>Male: <input id="male" value='male' type="radio" name="gender" checked/></label>
        <label for='female' class="br center-gender">Female: <input value='female' type='radio' id="female" name='gender'/></label>
        <p id="checkbox-title">Select which apply:</p>
        <div id='checkbox'>
          <label  class='interests' for='health' ><input class='align' value='health' type='checkbox' name='interests' id='health' checked/>Health</label>
          <label  class='interests' for='fitness'><input class='align' value='fitness' type='checkbox' name='interests' id='fitness'/>Fitness</label>
         <label  class='interests' for='diet'><input class='align'  value='diet' type='checkbox' name='interests'  id='diet'/>Diet</label>
         <label  class='interests' for='movies'><input  class='align' value='movies' type='checkbox' name='interests' id='movies'/>Movies</label>
         <label  class='interests' for='outdoors'><input  class='align' value='outdoors' type='checkbox' name='interests' id='outdoors'/>Outdoors</label>
         <label class='interests' for='travel'><input  class='align' value='travel' type='checkbox' name='interests' id='travel'/>Travel</label>
         <label  class='interests' for='games'><input  class='align' value='games' type='checkbox' name='interests' id='games'/>Games</label>
        </div>
      </fieldset>
      <fieldset>
        <label for='textarea' id='text-label'>Please provide additional comments:</label>
        <textarea placeholder="Your comments..." id="textarea" rows='15' cols='70' name='textarea'></textarea>
      </fieldset>
      <input id='submit' value='Submit' type='submit'/>
    </form>
  </body>
  <!--validated at https://validator.w3.org/nu/#textarea on 5-23-22 both html and css-->
</html>

              
            
!

CSS

              
                *{
  padding:0;
  margin:0;
}
body {
	width: 100vw;
  background-color: rgba(145,0,255,0.2);
}
h1,p{
  position:relative;
  text-align: center;
}
h1{
  font-family: 'Montserrat', sans-serif;
}
p{
  font-family: Georgia, sans-serif;
  line-height: 3em;
  text-transform: capitalize;
}
input,textarea,select{
  background-color: #F7F9F9;
  padding: 5px;
  border-radius: 6px;
}
#survey-form{
  position:relative;
  width: 90%;
  margin: 35px auto;
  background-color: rgba(253,232,200,0.9);
  border: 5px solid rgba(172,156,164,0.8);
}
fieldset {
  width: 90%;
  margin: 5px auto;
  border:none;
}
#name-label,#email-label,#number-label,#dropdown,.center-gender{
  display: block;
  width: 65%;
  margin: 5px auto;
}
#name,#email,#number{
  width: 100%;
  cursor: text;
}
#name:focus,#email:focus,#number:focus,#dropdown:focus,#textarea:focus{
  border: 4px solid rgb(75,26,51);
}
#dropdown{
  margin: 15px auto;
}
input[type='radio']{
   position:relative;
   left: 3%;
   margin-top: 3%;
}
.br{
  display:block;
}
#male {
    left: 5.4%;
}
#checkbox-title{
  text-align: unset;
  margin: 15px 17.4%;
}
.interests{
  position:relative;
  left: 17.3%;
}
.align{
  vertical-align: baseline;
}
#textarea{
  cursor: text;
}
#text-label,#textarea{
  display: block;
  position:relative;
  margin: 15px auto;
}
#text-label{
  left: 35%;
  font-size:1.2em;
}
input[type='submit']{
  position:relative;
  display:block;
  margin: 50px auto;
  width: 200px;
  height: 40px;
  border-radius: 5px;
  cursor:pointer;
  box-shadow: 5px 4px 18px 1px rgba(0, 0, 0, 0.5);
  background-color: #D5DBDB;
  color:#8E44AD;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 19px;
  font-size: 1.2em;
}
#submit:active{
  transform: scale(0.98);
  box-shadow: 3px 2px 15px 1px rgba(0, 0, 0, 0.5);
}

@media screen and (min-width: 200px) and (max-width: 400px){
    body{
       width: 95vw;
    }
    #survey-form, fieldset,#textarea{
       width: 90%;
    }
    #dropdown{
       font-size: 0.8em;
    }
    input[type='radio']{
      left: 3%;
    }
    #male {
      left: 10%;
    }
    #checkbox-title, label{
      font-size: 0.9em;
    }
    #checkbox label{
      display: flex;
      align-items: center;
    }
    #textarea{ 
      margin:0px auto;
    }
    #text-label{
      left: 7%;
      font-size:0.9em;
    }
    input[type='submit']{
      position:relative;
      top: 12px;
      width: 180px;
      height: 30px;
      font-weight: 600;
      letter-spacing: 4px;
      font-size: 1em;
    }
}
@media screen and (min-width: 401px) and (max-width:528px) {
    body {
	     width: 95vw;
     }
     #survey-form, fieldset,#textarea{
       width: 90%;
     }
    #dropdown{
       font-size: 0.9em;
    }
    input[type='radio']{
      left: 2%;
    }
    #male {
      left: 6.3%;
    }
    #checkbox label{
      display: flex;
      align-items: center;
    }
    #text-label,#textarea{
      position: relative;
      top: 15px;
    }
    #text-label{
      left: 5%;
    }
    input[type='submit']{
      position:relative;
      top: 5px;
      width: 190px;
      height: 40px;
      font-weight: 700;
      letter-spacing: 8px;
      font-size: 1em;
    }
}
@media screen and (min-width: 529px) and (max-width:768px){
    body {
	     width: 98vw;
     }
     #survey-form, fieldset,#textarea{
       width: 93%;
     }
 
    input[type='radio']{
      left: 2%;
    }
    #male{
      left: 6%;
    }
    #checkbox-title, label{
      font-size: 0.9em;
    }
    #checkbox label{
      display: flex;
      align-items: center;
    }
    #text-label,#textarea{
      position: relative;
      top: 25px;
    }
    #text-label{ 
      left:4%;
    }
    input[type='submit']{
      position:relative;
      height: 50px;
      font-weight: 700;
      letter-spacing: 10px;
      font-size: 1em;
    }
}

              
            
!

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