Pen Settings



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


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


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.


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.


                <div class="form-item">
  <label class="form-item__label" for="select">Select with fake placeholder</label>
  <div class="select-wrap">
    <select id="select" class="form-item__element form-item__element--select" required>
      <option disabled selected value="">Please select value</option>
      <option value="1">Value 1</option>
      <option value="2">Value 2</option>

<div class="form-item">
  <label class="form-item__label" for="input">Input with placeholder</label>
  <input id="input" placeholder="Please enter value" class="form-item__element">

<div class="info">
  <h2>About this pen</h2>
  <p>You can read more about this pen in the following article:<br><a href="">Faking a Placeholder in a HTML Select Form Field</a></p>
  <p>Pure HTML+CSS solution:<br><a href="">Fake Select Placeholder with Pure CSS</a></p>


                $default-color: #444;

.form-item {
  &:not(:first-child) {
    margin-top: 1em;
  > :not(:first-child) {
    margin-top: 0.25em;

.form-item__label {
  display: block;

.form-item__element {
  display: inline-block;
  padding: 0.5em;
  vertical-align: middle;
  background: #fff;
  border-radius: 4px;
  border: 1px solid gray;

.form-item__element--select {
  appearance: none;
  padding-right: 2em;
  // The select element is set to required
  // as long as the selected options value
  // is empty the element is not valid.
  &:invalid {
    color: gray;
  // Optional select fields fallback.
  &.has-placeholder {
    color: gray;
  // Styling for browsers which do support
  // styling select option elements directly
  [disabled] {
    color: gray;
  option {
    color: $default-color;

// Quick and dirty ugly caret replacement.
.select-wrap {
  &::after {
    margin-left: -2em;
    font-size: 0.75em;
    pointer-events: none;
    content: '▼';

.info {
  max-width: 42em;
  p {
    line-height: 1.5;

body {
  padding: 1em;
  color: $default-color;

* {
  box-sizing: border-box;



                // The following JavaScript is only needed if you
// need the placeholder functionality for select
// elements which are not required fields.

// Add class with JavaScript so everything still
// looks decent without JavaScript available.

// Remove the fake placeholder class when the value of select changes, because
// the placeholder option is disabled, it can't be selected anymore and there is
// no need for the `has-placeholder` class to be applied again.
document.querySelector('select').addEventListener('change', (e) => {