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

              
                <body>
  <header class="header">
    <!-- Image added in CSS -->
  </header>
  <main>
    <form action="submit" method="get" id="survey-form">
      <div class="form-icon-div">
        <i class="fa fa-empire fa-5x form-icon" aria-hidden="true"></i>
      </div>
      <p id="description" class="form-title">Please fill out the form below to receive more information about <a href="http://starwars.wikia.com/wiki/Galactic_Empire" title="Galactic Empire Wiki" class="empire-wiki" target="_blank">The Empire</a>.</p>

      <label for="name" id="name-label" class="bold margin">*Name:</label>
      <input id="name" type="text" placeholder="Enter your full name" required>

      <label for="email" id="email-label" class="bold margin">*E-Mail:</label>
      <input id="email" type="email" placeholder="Enter your primary email address" required>

      <label for="number" id="number-label" class="bold margin">*Age:</label>
      <input id="number" type="number" min="1" max="1000" placeholder="100" required>

      <label for="dropdown" id="dropdown-label" class="bold margin">Species:</label>
      <select id="dropdown" name="dropdown">
        <option>Human</option>
        <option>Rodian</option>
        <option>Zabraks</option>
        <option>Twi’leks</option>
        <option>Other</option>
      </select>

      <fieldset class="lightsaber">
        <legend class="radio-legend bold">Lightsaber Color:</legend>
        <input type="radio" id="radio1" class="radio" name="radio" value="saber-color">
        <label for="radio1" id="radio-option1" class="radio-label">Red</label>

        <input type="radio" id="radio2" class="radio" name="radio" value="saber-color">
        <label for="radio2" id="radio-option2" class="radio-label">Red</label>

        <input type="radio" id="radio3" class="radio" name="radio" value="saber-color">
        <label for="radio3" id="radio-option3" class="radio-label">Red</label>
      </fieldset>

      <fieldset class="dark">
        <legend class="checkbox-legend bold">How Dark Are You?</legend>
        <input type="checkbox" id="checkbox1" name="checkbox" value="dark" class="checkbox">
        <label for="checkbox1" class="checkbox-label" id="check-option1">Dark</label>

        <input type="checkbox" id="checkbox2" name="checkbox" value="mostly-dark" class="checkbox">
        <label for="checkbox2" class="checkbox-label" id="check-option2">Mostly Dark</label>

        <input type="checkbox" id="checkbox3" name="checkbox" value="kinda-dark" class="checkbox">
        <label for="checkbox3" class="checkbox-label" id="check-option3">Kinda Dark</label>
      </fieldset>

      <label for="textarea" id="textarea-label" class="bold">Comments:</label>
      <textarea id="textarea" rows="10" cols="20" placeholder="Comments, questions, concerns..."></textarea>

      <button id="submit">Submit</button>
    </form>
  </main>
  <footer>
    <h1 id="title" class="footer-h1">Coded by Stephan Lamoureux for <a href="https://www.freecodecamp.org/slamoureux" target="_blank">freeCodeCamp <i class="fa fa-free-code-camp"></i></a></h1>
    <div class="my-links">
      <a href="https://github.com/slamoureux/survey-form" target="_blank" class="footer-link" title="Github Repository">
        <i class="fa fa-github fa-2x" aria-hidden="true"></i></a>
      <a href="https://codepen.io/s-lamoureux/full/zpMqNM/" target="_blank" class="footer-link" title="Codepen Page">
        <i class="fa fa-codepen fa-2x" aria-hidden="true"></i></a>
      <a href="https://twitter.com/sa_lamoureux" target="_blank" class="footer-link" title="My Twitter Account">
        <i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a>
    </div>
  </footer>
</body>
              
            
!

CSS

              
                body {
  background-color: black;
  font-family: sans-serif;
  margin-bottom: 30px;
}

.header {
  background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1369185/vader.jpg");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

h1 {
  text-align: center;
  color: white;
  font-size: 1.7em;
  margin: 0;
}

img {
  margin: 0 auto;
  max-width: 55%;
  display: block;
}

.bold {
  font-weight: 800;
}

/* Form Main */

form {
  display: grid;
  grid-template-columns: 1fr 3fr;
  padding: 1em 1em 1.5em 1em;
  background: #f0f0f0;
  border: 5px solid #757575;
  margin: 0 auto 0 auto;
  max-width: 700px;
  border-radius: 4px;
  text-align: center;
}

form input {
  background: #ffffff;
  border: 2px solid black;
  margin-right: 2em;
}

input,
select {
  padding: 0.7em;
  margin-bottom: 0.5em;
  border: 2px solid black;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #ff3333;
}

input,
button,
fieldset,
select,
textarea {
  grid-column: 2 / 3;
}

label {
  padding: 0.5em 1em 0.5em 1em;
  margin-right: 2em;
  text-align: right;
  grid-column: 1 / 2;
}

/* Form Header */

.form-title {
  text-align: center;
  color: white;
  grid-column: 1 / 3;
  background: black;
  padding: 1em;
  margin-bottom: 25px;
  font-size: 15px;
}

.form-icon-div {
  grid-column: 1 / 3;
}

.form-icon {
  grid-column: 1 / 3;
  color: black;
  text-align: center;
  display: block;
  margin: 0 auto;
  padding-bottom: 5px;
}

.empire-wiki:link,
.empire-wiki:visited,
.empire-wiki:active {
  text-decoration: none;
  color: #ff3333;
}

.empire-wiki:hover {
  color: #ff3333;
  text-decoration: underline;
}

p {
  text-align: center;
  color: white;
  padding-bottom: 15px;
  font-weight: bold;
}

/* Radio Buttons */

.radio {
  margin: 0 5px 0 0;
}

.radio-label {
  font-size: 1.1em;
}

.radio-legend {
  text-align: left;
  padding: 0 5px;
}

.lightsaber {
  margin: 0 1.6em 0.5em 0;
  padding: 1em 1em 1.5em 1em;
  background: white;
  border: black 2px solid;
}

/* Checkboxes */

.checkbox {
  margin: 0 5px 0 0;
}

.checkbox-label {
  font-size: 1.1em;
}

.checkbox-legend {
  text-align: left;
  padding: 0 5px;
}

.dark {
  margin: 0 1.6em 0.5em 0;
  padding: 1em 1em 1.5em 1em;
  background: #ffffff;
  border: black 2px solid;
}

/* Radio/Checkbox Fieldsets */

form fieldset {
  margin: 0 auto;
  text-align: right;
}

fieldset label {
  padding: 0;
}

/* Select Menu */

form select {
  margin-right: 2em;
  border: 2px solid black;
  background: white;
}

/* Comments Textarea */

textarea {
  padding: 0.5em 0.5em 0 0.5em;
  margin: 0.7em 0.7em 1.5em 0.7em;
  background: white;
  width: 92%;
  border: 2px solid black;
  margin-right: 2em;
  margin-left: 0;
}

/* Submit Button */

form button {
  grid-column: 1 / 3;
  background: black;
  font-size: 1em;
  font-weight: 800;
  padding: 1em;
  width: 100%;
  margin: 0 auto;
  border: 0;
  color: white;
}

form button:hover {
  outline: 2px solid #ff3333;
  color: #ff3333;
}

/* Footer */

footer a:link,
footer a:visited,
footer a:active {
  color: white;
  text-decoration: none;
}

footer a:hover {
  color: #ff3333;
}

.footer-h1 {
  font-size: 1em;
  padding-top: 30px;
  margin-bottom: 20px;
}

.my-links {
  padding-bottom: 5px;
  text-align: center;
}

.footer-link {
  padding: 0 15px 0 15px;
}

.footer-link:link,
.footer-link:active,
.footer-link:visited {
  text-decoration: none;
  color: #f9f9f9;
}

.footer-link:hover {
  color: #ff3333;
}

/* Mobile Responsive */

/* Small Mobile */

@media only screen and (min-width: 320px) and (max-width: 374px) {
  form label {
    text-align: left;
    grid-column: 1 / 2;
    padding-left: 0;
  }
  input {
    grid-column: 1 / 3;
    width: 91%;
  }
  textarea {
    grid-column: 1 / 3;
    width: 93%;
    margin-top: 0;
  }
  select {
    grid-column: 1 / 3;
    width: 99%;
    margin-bottom: 20px;
  }
  fieldset {
    grid-column: 1 / 3;
  }
  /* Radios */
  .radio-legend {
    text-align: center;
  }
  .radio {
    width: auto;
    float: left;
    margin-left: 6%;
  }
  .radio-label {
    float: left;
    margin-right: 3%;
    padding: 0 2px 0 0;
  }
  .lightsaber {
    text-align: center;
    grid-column: 1 / 3;
    width: 86%;
    padding: 1em;
    margin-bottom: 10px;
  }
  /* Checkboxes */
  .checkbox {
    float: left;
    margin-right: 5px;
    margin-left: 12%;
    width: auto;
  }
  .checkbox-legend {
    text-align: center;
  }
  .checkbox-label {
    float: left;
    margin: 0;
    padding: 0 8px 20px 0;
  }
  .dark {
    text-align: center;
    grid-column: 1 / 3;
    margin-right: 0;
    padding: 8% 0 0 0;
    width: 98%;
  }
}

/* Medium Mobile */

@media only screen and (min-width: 375px) and (max-width: 424px) {
  form label {
    text-align: left;
    grid-column: 1 / 2;
    padding-left: 0;
  }
  input {
    grid-column: 1 / 3;
    width: 92%;
  }
  textarea {
    grid-column: 1 / 3;
    width: 94%;
    margin-top: 0;
  }
  select {
    grid-column: 1 / 3;
    width: 99%;
    margin-bottom: 20px;
  }
  fieldset {
    grid-column: 1 / 3;
  }

  /* Radios */
  .radio-legend {
    text-align: center;
  }
  .radio {
    width: auto;
    float: left;
    margin-left: 9%;
  }
  .radio-label {
    float: left;
    margin-right: 3%;
    padding: 0 2px 0 0;
  }
  .lightsaber {
    text-align: center;
    grid-column: 1 / 3;
    width: 88%;
    margin-bottom: 20px;
  }
  /* Checkboxes */
  .checkbox {
    float: left;
    margin-left: 8%;
    width: auto;
  }
  .checkbox-legend {
    text-align: center;
  }
  .checkbox-label {
    float: left;
    margin: 0 5px 0 0;
    padding: 0 12% 20px 0;
  }
  .dark {
    text-align: center;
    grid-column: 1 / 3;
    width: 93%;
    padding-bottom: 0;
    padding-right: 0;
  }
}

/* Large Mobile */

@media only screen and (min-width: 425px) and (max-width: 767px) {
  form label {
    text-align: left;
    grid-column: 1 / 2;
    padding-left: 0;
    margin-bottom: 5px;
  }
  input {
    grid-column: 1 / 3;
    width: 92%;
  }
  textarea {
    grid-column: 1 / 3;
    width: 95%;
    margin-top: 0;
  }
  select {
    grid-column: 1 / 3;
    width: 98%;
    margin-bottom: 20px;
  }
  fieldset {
    grid-column: 1 / 3;
  }
  /* Radios */
  .radio-legend {
    text-align: center;
  }
  .radio {
    width: auto;
    float: left;
    margin-left: 10%;
  }
  .radio-label {
    float: left;
    margin-right: 5%;
    padding: 0 2px 0 0;
  }
  .lightsaber {
    text-align: center;
    grid-column: 1 / 3;
    width: 88%;
    margin-bottom: 20px;
  }
  /* Checkboxes */
  .checkbox {
    width: auto;
    float: left;
    margin-left: 2.7%;
  }
  .checkbox-legend {
    text-align: center;
  }
  .checkbox-label {
    float: left;
    margin-right: 2%;
    padding: 0 2px 0 0;
  }
  .dark {
    text-align: center;
    width: 88%;
    grid-column: 1 / 3;
  }
}

              
            
!

JS

              
                $(document).ready(function(){
 $('.header').height($(window).height());
});
              
            
!
999px

Console