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. 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

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

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<h1 id="title">Survey Form</h1> 
<div class="container">
  <p id="description">Please let us know your opinion on Brexit</p>   
  <form id="survey-form">
    <div class="inner-container">
      <div class="detail-input">
        <div class="text-input-label">
          <label for="name" id="name-label">* Name:</label>
        </div>
        <div class="text-input-box">
          <input type="text" class="input-field" id="name" placeholder="Your name" required>
        </div>
      </div>

      <div class="detail-input">
        <div class="text-input-label">
          <label for="email" id="email-label">* Email:</label> 
        </div>
        <div class="text-input-box">
          <input type="email" class="input-field" id="email" placeholder="Your email" required>
        </div>
      </div>

      <div class="detail-input">
        <div class="text-input-label">
          <label for="age" id="number-label">* Age:</label>
        </div>
        <div class="text-input-box">
          <input type="number" class="input-field" id="number" min="18" max="100" placeholder="Age" required>
        </div>
      </div>

      <div class="detail-input">
        <div class="text-input-label">
          Occupation
        </div>
        <div class="text-input-box">
          <select class="dropdown" id="dropdown" required>
            <option value="" disabled selected hidden>Please Choose...</option>
            <option value="toff">Aristocrat</option>
            <option value="peasant">Peasant</option>
            <option value="student">Student</option>
            <option value="other">Other</option>
          </select>
        </div>
      </div>

      <div class="subject-input">
        <div class="label-other" id="disastrous">
          How disastrous is Brexit?
        </div>
        <div class="radio-div">
          <div>
            <input type="radio" id="option1" name="radio-options" value="r1"/>
            <label for="option1">Pretty disastrous</label>
          </div>
          <div>
            <input type="radio" id="option2" name="radio-options" value="r2"/>
            <label for="option2">Incredibly disastrous</label>
          </div>
          <div>
            <input type="radio" id="option3" name="radio-options" value="r3"/>
            <label for="option3">Utterly catastrophic</label>
          </div>
        </div>
      </div>

      <div class="subject-input">
        <div class="label-other" id="problem">
          What are the problems with Brexit?
        </div>
        <div class="checkbox-div">
          <div>
            <input type="checkbox" id="check1" name="problems" value="c1">
            <label for="check1">Lack of leadership</label>
          </div>
          <div>
            <input type="checkbox" id="check2" name="problems" value="c2">
            <label for="check2">Boris Johnson</label>
          </div>
          <div>
            <input type="checkbox" id="check3" name="problems" value="c3">
            <label for="check3">Lack of a plan</label>
          </div>
          <div>
            <input type="checkbox" id="check5" name="problems" value="c5">
            <label for="check5">Arrogance</label>
          </div>
        </div>
      </div>

      <div class="subject-input">
        <div class="label-other" id="comments">
          Leave a Comment
        </div>
        <div class="comment-div">
          <textarea class="text-box" id="comment" name="comment-box"
                    rows="3" cols="33" maxlength="200"
                    wrap="hard" placeholder="Type your comment here..."></textarea>
        </div>
      </div>
    </div>
    <button class="submit" id="submit" type="submit">Submit</button>
  </form>
</div>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Roboto');

body {
  background-color: #809DA5;
  color: white;
  font-family: 'Roboto', sans-serif;
  text-align: center;
  min-width: 320px;
}

.container {
  width: 90%;
  background-color: #EDF9FC;
  color: black;
  border-radius: 5px;
  display: inline-block;
}

.inner-container {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, 50px) 90px 180px 50px; 
  grid-column-gap: 10px;
  align-items: center;
  justify-items: center;
}

.detail-input {
  width: 95%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column-gap: 10px;
}

.subject-input {
  width: 95%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column-gap: 10px;
}

#title {
  margin: 30px;
}

#description {
  margin: 2em;
}

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

.dropdown {
  height: 32px;
  width: 212px;
  padding: 5px;
  border-radius: 5px;
}

.text-input-label {
  justify-self: end;
  margin-right: 20px;
}

.text-input-box {
  justify-self: start;
}

.label-other {
  justify-self: end;
  align-self: start;
}

#disastrous {
  margin: 20px 20px 0 0;
}

#problem {
  margin: 40px 20px 0 0;
}

#comments {
  margin: 30px 20px 0 0;
}

.radio-div {
  justify-self: start;
  align-self: start;
  width: 200px;
  display: grid;
  grid-template-rows: repeat(3, 30px);
  justify-items: start;
  margin-top: 20px;
}

.checkbox-div {
  justify-self: start;
  align-self: start;
  width: 200px;
  display: grid;
  grid-template-rows: repeat(4, 30px);
  justify-items: start;
  margin-top: 40px;
}

.comment-div {
  justify-self: start;
  align-self: start;
  width: 50%;
  margin-top: 30px;
}

.submit {
  margin: 5em 0 3em 0;
  background-color: #35B2D1;
  width: 100px;
  height: 40px;
  color: white;
  border-radius: 5px;
  border: 0px solid;
}

.text-box {
  width: 200px;
  border: 1px solid #c0c0c0;
  border-radius: 5px;
}

select:invalid { color: gray; }

@media (max-width: 768px) {
  .inner-container {
    grid-template-rows: repeat(4, 50px) auto auto auto; 
  }

  .input-field {
    width: 200px;
  }

  .detail-input {
    grid-template-columns: 1fr 2fr;
    grid-column-gap: 10px;
  }

  .subject-input {
    grid-template-columns: 1fr;
    grid-template-rows: 50px auto;
  }

  .label-other {
    justify-self: start;
    align-self: center;
  }

  .radio-div {
    justify-self: center;
    justify-items: start;
    grid-template-rows: repeat(3, auto);
  }

  .checkbox-div {
    justify-self: center;
    justify-items: start;
  }

  .comment-div {
    justify-self: center;
  }

  .text-box {
    width: 100%;
  }

  #disastrous, #problem, #comments {
    margin-left: 100px;
  }
} 

@media (max-width: 570px) {
  #disastrous, #problem, #comments {
    margin-left: 50px;
  }
}

@media (max-width: 420px) {
  .container {
    background-color: yellow;
    width: 100%;
  }

  .inner-container {
    width: 100%;
    grid-template-rows: repeat(4, auto) auto auto auto; 
  }

  .input-field {
    width: 200px;
  }

  .detail-input {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    grid-row-gap: 10px;
    margin-bottom: 10px;
  }

  .text-input-label {
    justify-self: start;
    margin-left: 20px;
    margin-top: 10px;
  }

  .text-input-box {
    justify-self: center;
  }

  #disastrous, #problem, #comments {
    margin-left: 20px;
  }
}

@media (max-width: 320px) {

  .container {
    background-color: orange;
  }

  .checkbox-div {
    justify-self: center;
    width: 66%;
    grid-template-rows: repeat(4, auto);
    justify-items: start;
  }

  .comment-div {
    justify-self: start;
    margin-left: 20px;
  }

  .text-box {
    width: 200px;
    margin-left: 30px;
  }

  #disastrous, #problem, #comments {
    margin-left: 10px;
  }
}
              
            
!

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