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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                  <h1 id="title">Sleep Situation Survey Form</h1>
  <p id="description">This survey form is used to record people's sleep status <span>Thank you for helping fill out
      the form</span></p>
  <form action="#" id="survey-form">
    <div class="basic-info">
      <div class="info">
        <div>
          <label for="name" id="name-label">Name</label>
          <input type="text" name="name" id="name" placeholder="Enter your name" required>
        </div>
        <div>
          <label for="email" id="email-label">Email</label>
          <input type="email" name="email" id="email" placeholder="Enter your email" required>
        </div>
      </div>
      <div class="info">
        <div>
          <label for="number" id="number-label">Age</label>
          <input type="number" name="age" min="0" max="100" id="number" placeholder="Enter your age">
        </div>
        <div>
          <p>Gender</p>
          <div class="gender">
            <label for="male"><input name="gender" value="male" type="radio" id="male" class="input-radio"
                checked>Male</label>
            <label for="female"><input name="gender" value="female" type="radio" id="female"
                class="input-radio">Female</label>
            <label for="other"><input name="gender" value="other" type="radio" id="other"
                class="input-radio">Other</label>
          </div>
        </div>
      </div>
    </div>
    <div class="sleep-situation">
      <div>
        <p>How long do you sleep at night?</p>
        <select name="sleep-time" id="dropdown">
          <option disabled selected value>Select your sleelp time</option>
          <option value="less-four">Less than 4 hours</option>
          <option value="four-to-five">4 - 5 hours</option>
          <option value="six-to-seven">6 - 7 hours</option>
          <option value="eight-to-nine">8 - 9 hours</option>
          <option value="more-nine">More than 9 hours</option>
        </select>
      </div>
      <div>
        <p>How long does it take you to fall asleep?</p>
        <select name="fall-asleep">
          <option disabled selected value>Select fall ssleelp time</option>
          <option value="fifteen">0 - 15 mins</option>
          <option value="thirty">16 - 30 mins</option>
          <option value="forty-four">31 - 45 mins</option>
          <option value="sixty">46 - 60 mins</option>
          <option value="more">More than 60 mins</option>
        </select>
      </div>
      <div>
        <p>How would you rate your sleep quality?</p>
        <div class="sleep-quality">
          <label for="very-good"><input type="radio" name="quality" value="very-good" id="very-good"
              class="input-radio">Very good</label>
          <label for="good"><input type="radio" name="quality" value="good" id="good" class="input-radio">Good</label>
          <label for="average"><input type="radio" name="quality" value="average" id="average"
              class="input-radio">Average</label>
        </div>
        <div class="sleep-quality">
          <label for="poor"><input type="radio" name="quality" value="poor" id="poor" class="input-radio">Poor</label>
          <label for="very-poor"><input type="radio" name="quality" value="very-poor" id="very-poor"
              class="input-radio">Very poor</label>
        </div>
      </div>
      <div>
        <p>What kind of sleep problems do you have?</p>
        <div class="sleep-problem">
          <div class="problems">
            <label for="insomnia"><input type="checkbox" name="sleep-problem" value="insomnia" id="insomnia"
                class="input-checkbox">Insomnia</label>
            <label for="sleep-deprivation"><input type="checkbox" name="sleep-problem" value="sleep-deprivtion"
                id="sleep-deprivation" class="input-checkbox">Sleep
              deprivation</label>
            <label for="sleep-disorder"><input type="checkbox" name="sleep-problem" value="sleep-disorder"
                id="sleep-disorder" class="input-checkbox">Sleep
              disorder</label>
            <label for="jet-lag"><input type="checkbox" name="sleep-problem" value="jet-lag" id="jet-lag"
                class="input-checkbox">Jet lag</label>
            <label for="night-terrors"><input type="checkbox" name="sleep-problem" value="night-terrors"
                id="night-terrors" class="input-checkbox">Night terrors</label>
          </div>
          <div class="problems">
            <label for="teeth-grinding"><input type="checkbox" name="sleep-problem" value="teeht-grinding"
                id="teeth-grinding" class="input-checkbox">Teeth
              grinding</label>
            <label for="nightmare"><input type="checkbox" name="sleep-problem" value="nightmare" id="nightmare"
                class="input-checkbox">Nightmare</label>
            <label for="sleepwalking"><input type="checkbox" name="sleep-problem" value="sleepwalking" id="sleepwalking"
                class="input-checkbox">Sleepwalking</label>
            <label for="none"><input type="checkbox" name="sleep-problem" value="sleep-problem" id="none"
                class="input-checkbox">None</label>
          </div>
        </div>
      </div>
    </div>
    <div class="textarea">
      <p>Anything you want to tell or share to us?</p>
      <textarea id="tell" placeholder="Enter anything you want to tell us"></textarea>
    </div>
    <div>
      <button type="submit" id="submit">Submit</button>
    </div>
  </form>

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

              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
  letter-spacing: 1px;
  outline: none;
}

body {
  position: relative;
  width: 100%;
  height: 100%;
  background: url(https://i.postimg.cc/Hx8VPyT8/bg.jpg) no-repeat center center / cover;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  font-size: 18px;
}

body::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background: rgba(132, 129, 122, 0.7);
  z-index: -1;
}

#title {
  font-size: 40px;
  letter-spacing: 2px;
  margin: 40px 0 20px;
  text-shadow: 3px 2px #494640;
  text-align: center;
}

#description {
  margin: 0 0 30px;
  text-align: center;
}

#description span {
  display: block;
  margin-top: 5px;
  text-align: center;
  color: #494640;
}

form {
  width: 650px;
  height: 100%;
  padding: 40px;
  background: rgba(58, 56, 53, 0.4);
  border-radius: 10px;
  margin-bottom: 40px;
}

input::placeholder,
textarea::placeholder {
  font-size: 16px;
}

.input-radio,
.input-checkbox {
  margin: 0 5px 0 10px;
  cursor: pointer;
}

#male,
#very-good,
#poor,
.input-checkbox {
  margin-left: 0;
}

#name-label,
#email-label,
#number-label,
p {
  font-weight: 700;
}

.basic-info {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
}

.basic-info::after {
  position: absolute;
  content: "";
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(221, 221, 221, 0.3);
}

.basic-info input[type="text"],
.basic-info input[type="email"],
.basic-info input[type="number"] {
  display: block;
  margin: 5px 0 15px;
  padding-left: 10px;
  width: 270px;
  height: 40px;
  border-radius: 5px;
  border: none;
}

.basic-info .gender {
  display: flex;
  margin: 5px 0 0;
  align-items: center;
  height: 40px;
}

.sleep-situation {
  position: relative;
}

.sleep-situation::after {
  position: absolute;
  content: "";
  bottom: 0px;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(221, 221, 221, 0.3);
}

.sleep-situation div {
  margin: 0 0 25px;
}

.sleep-situation div p {
  margin: 5px 0 10px;
}

.sleep-situation div select {
  width: 100%;
  height: 40px;
  border-radius: 5px;
  border: none;
  font-size: 16px;
  padding-left: 10px;
}

.sleep-situation .sleep-quality {
  margin: 0 0 5px;
}

.sleep-situation .sleep-quality:last-child {
  margin: 0;
}

.sleep-situation .sleep-problem {
  display: flex;
  justify-content: flex-start;
}

.sleep-situation .sleep-problem .problems:first-child {
  margin-right: 80px;
}

.sleep-situation .sleep-problem .problems {
  display: flex;
  flex-direction: column;
}

.sleep-situation .sleep-problem .problems label {
  padding-bottom: 5px;
}

.textarea {
  margin: 0 0 20px;
}

.textarea p {
  margin: 0 0 10px;
}

.textarea textarea {
  width: 100%;
  padding: 10px 10px;
  height: 150px;
  border: none;
  border-radius: 5px;
}

#submit {
  width: 100%;
  padding: 15px 0;
  font-size: 20px;
  letter-spacing: 2px;
  border: none;
  background: #3a3835;
  color: #fff;
  cursor: pointer;
  border-radius: 5px;
}

#submit:hover {
  background: #494640;
}

#submit:active {
  transform: scale(0.95);
}

@media (max-width: 670px) {
  #title {
    font-size: 30px;
  }

  form {
    width: 100%;
    border-radius: 0;
  }

  input::placeholder,
  textarea::placeholder {
    font-size: 14px;
  }

  .basic-info {
    display: block;
  }

  .basic-info input[type="text"],
  .basic-info input[type="email"],
  .basic-info input[type="number"] {
    margin-top: 10px;
    width: 100%;
  }

  .sleep-situation::after {
    bottom: -13px;
  }

  .sleep-situation .sleep-quality {
    display: flex;
    flex-direction: column;
  }

  .sleep-situation .sleep-quality input {
    margin-left: 0;
  }

  .sleep-situation .sleep-quality label,
  .sleep-situation .sleep-problem .problems label {
    padding-bottom: 10px;
  }

  .sleep-situation .sleep-problem {
    display: block;
    margin: 0;
  }

  .sleep-situation .sleep-problem .problems:first-child {
    margin-bottom: 0;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console