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

Auto Save

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

              
                <form action="">
  <fieldset>
    <legend>Without Contents</legend>
    <div class="control">
      <label for="input">input:</label>
      <input type="text" id="input" placeholder="input element">
    </div>
    <div class="control">
      <label for="textarea">textarea:</label>
      <textarea name="textarea" id="textarea" cols="30" rows="2"></textarea>
    </div>
    <div class="control">
      <label for="select">select:</label>
      <select name="select" id="select">
        <optgroup label="Default">
          <option value="opationA">optionA</option>
        </optgroup>
        <option value="optionB">optionB</option>
      </select>
    </div>
    <div class="control">
      <label for="checkbox">checkbox:</label>
      <input type="checkbox" name="checkbox" id="checkbox">
      checkbox
    </div>
    <div class="control">
      <label for="radio">radio:</label>
      <input type="radio" name="radio" id="radio">
      radio
    </div>
    <div class="control">
      <label for="range">range:</label>
      <input type="range" name="range" id="range" min="0" max="50" value="25" step="1">
    </div>
    <div class="control">
      <label for="submit">submit:</label>
      <input type="submit" name="submit" id="submit">
    </div>
    <div class="control">
      <button>button</button>
    </div>
    <div class="control">
      <details>
        <summary>Copying... </summary>
        <dl>
          <dt>Transfer rate:</dt>
          <dd>452KB/s</dd>
          <dt>Local filename:</dt>
          <dd>/home/rpausch/raycd.m4v</dd>
        </dl>
      </details>
    </div>
    <div class="control">
      <label for="meter">meter: </label>
      <meter min="0" max="100" value="75" name="meter" id="meter"></meter>
    </div>
    <div class="control">
      <label for="progerss">progress: </label>
      <progress min="0" max="100" value="75" name="meter" id="meter"></progress>
    </div>
  </fieldset>

  <fieldset class="contents">
    <legend>With Contents</legend>
    <div class="control">
      <label for="input">input:</label>
      <input type="text" id="input" placeholder="input element">
    </div>
    <div class="control">
      <label for="textarea">textarea:</label>
      <textarea name="textarea" id="textarea" cols="30" rows="2"></textarea>
    </div>
    <div class="control">
      <label for="select">select:</label>
      <select name="select" id="select">
        <optgroup label="Default">
          <option value="opationA">optionA</option>
        </optgroup>
        <option value="optionB">optionB</option>
      </select>
    </div>
    <div class="control">
      <label for="checkbox">checkbox:</label>
      <input type="checkbox" name="checkbox" id="checkbox">
      checkbox
    </div>
    <div class="control">
      <label for="radio">radio:</label>
      <input type="radio" name="radio" id="radio">
      radio
    </div>
    <div class="control">
      <label for="range">range:</label>
      <input type="range" name="range" id="range" min="0" max="50" value="25" step="1">
    </div>
    <div class="control">
      <label for="submit">submit:</label>
      <input type="submit" name="submit" id="submit">
    </div>
    <div class="control">
      <button>button</button>
    </div>
    <div class="control">
      <details>
        <summary>Copying... </summary>
        <dl>
          <dt>Transfer rate:</dt>
          <dd>452KB/s</dd>
          <dt>Local filename:</dt>
          <dd>/home/rpausch/raycd.m4v</dd>
        </dl>
      </details>
    </div>
    <div class="control">
      <label for="meter">meter: </label>
      <meter min="0" max="100" value="75" name="meter" id="meter"></meter>
    </div>
    <div class="control">
      <label for="progerss">progress: </label>
      <progress min="0" max="100" value="75" name="meter" id="meter"></progress>
    </div>
  </fieldset>
</form>

<div class="form">
  <span>display:</span>
  <label for="initial">
    <input type="radio" id="initial" name="display" value="initial" checked />
    initial
  </label>
  <label for="contents">
    <input type="radio" id="contents" name="display" value="contents" />
    contents
  </label>
  <label for="none">
    <input type="radio" id="none" name="display" value="none" />
    none
  </label>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  background-color: #557;
  padding: 2rem 0;
  color: #fff;

  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 20px;
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  width: 100%;
  max-width: 60vw;
  font-size: 16px;
}

fieldset {
  padding: 10px;
}

.control {
  display: flex;
  alig-items: center;
  gap: 10px;
}

.control + .control {
  margin-top: 16px;
}

.form {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 1.5rem;
}

.form label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.form input {
  width: 18px;
  height: 18px;
}

.contents,
.contents legend,
.contents label,
.contents input,
.contents select,
.contents button,
.contents details,
.contents summary,
.contents meter,
.contents progress {
  display: var(--display, initial);
}

              
            
!

JS

              
                const rootEle = document.documentElement;
const inputs = document.querySelectorAll('input[type="radio"]');

inputs.forEach((input) => {
  input.addEventListener("click", (etv) => {
    rootEle.style.setProperty("--display", etv.target.value);
  });
});

              
            
!
999px

Console