Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Age Survey</title>
    <link rel="stylesheet" type="text/css" href="styles.css"/>
  </head>
  <body>
    <header>
      <h1 id="title">Age Survey Form</h1>
      <p id="description">
        Thank you for telling us about your age
      </p>
    </header>
    <!-- Enter a valid server to receive survey data -->
    <form id="survey-form" action="https://survey-form.mywebsite.com">
      <fieldset>
        <label id="name-label" for="name">Name</label>
        <input
          id="name"
          name="name"
          type="text"
          placeholder="Enter your name"
          required
        />
        <label id="email-label" for="email">Email</label>
        <input
          id="email"
          name="email"
          type="email"
          placeholder="Enter your email"
          required
        />
        <label id="number-label" for="number">Age</label>
        <input
          id="number"
          type="number"
          name="age"
          min="0"
          max="119"
          placeholder="Enter your age"
          required
        />
        <label id="dropdown-label">How old are you?
          <select id="dropdown" name="age-range" required>
            <option value="">(select one)</option>
            <option value="0-19">0–19</option>
            <option value="20-39">20–39</option>
            <option value="40-59">40–59</option>
            <option value="60-79">60–79</option>
            <option value="80-99">80–99</option>
            <option value="100-119">100–119</option>
          </select>
        </label>
        <label id="radio-label">When were you born?
          <div class="columns">
            <label>
              <input
                class="inline"
                type="radio"
                name="year"
                value="1903-1922"
              />1903–1922</label>
            <label>
              <input
                class="inline"
                type="radio"
                name="year"
                value="1923-1942"
              />1923–1942</label>
            <label>
              <input
                class="inline"
                type="radio"
                name="year"
                value="1943-1962"
              />1943–1962</label>
            <label>
              <input
                class="inline"
                type="radio"
                name="year"
                value="1963-1982"
              />1963–1982</label>
            <label>
              <input
                class="inline"
                type="radio"
                name="year"
                value="1983-2002"
              />1983–2002</label>
            <label>
              <input
                class="inline"
                type="radio"
                name="year"
                value="2003-2022"
              />2003–2022</label>
          </div>
        </label>
      </fieldset>
      <fieldset>
        <label id="checkbox-label">Which numbers are in your age?
          <div class="columns-five">
            <label>
              <input
                class="inline"
                type="checkbox"
                value="0"
                name="age-numbers"
              />0
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="1"
                name="age-numbers"
              />1
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="2"
                name="age-numbers"
              />2
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="3"
                name="age-numbers"
              />3
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="4"
                name="age-numbers"
              />4
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="5"
                name="age-numbers"
              />5
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="6"
                name="age-numbers"
              />6
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="7"
                name="age-numbers"
              />7
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="8"
                name="age-numbers"
              />8
            </label>
            <label>
              <input
                class="inline"
                type="checkbox"
                value="9"
                name="age-numbers"
              />9
            </label>
          </div>
        </label>
      </fieldset>
      <fieldset>
        <label id="comment-label">Any comments about your age?
          <textarea
            id="comment"
            name="comment"
            placeholder="Enter your comment here..."
          ></textarea>
        </label>
      </fieldset>
      <button id="submit" type="submit">
        Submit
      </button>
    </form>
  </body>
</html>
              
            
!

CSS

              
                body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #05386B;
	color: #EDF5E1;
  font-family: Tahoma;
	font-size: 16px;
}

h1, p {
  margin: 1em auto;
  text-align: center;
}

form {
  width: 60vw;
	max-width: 500px;
	min-width: 300px;
	margin: auto auto;
  padding-bottom: 2em;
  padding-top: 1em;
  background-color: #379683;
	color: #EDF5E1;
  border-radius: 15px;
}

fieldset {
  border: none;
	padding: 0 1rem 0.5rem 1rem;
}

label {
  display: block;
	margin: 0 0 0 0;
}

input,
textarea,
select {
  margin: 0.5rem 0 1rem 0;
	width: 100%;
  min-height: 2em;
  background-color: #EDF5E1;
  border: 0;
  color: #05386B;
  border-radius: 4px;
}

.inline {
  width: unset;
  margin: 0 0.5rem 0 0;
  vertical-align: middle;
}

.columns {
  -webkit-column-count: 2; /* Chrome, Safari, Opera */
  -moz-column-count: 2; /* Firefox */
  column-count: 2;
}

.columns-five {
  -webkit-column-count: 5; /* Chrome, Safari, Opera */
  -moz-column-count: 5; /* Firefox */
  column-count: 5;
}

button {
  display: block;
  width: 60%;
  margin: 1em auto;
  height: 2em;
  font-size: 1.1rem;
  background-color: #8EE4AF;
  color: #05386B;
  border: 0;
  min-width: 100px;
}
              
            
!

JS

              
                
              
            
!
999px

Console