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

              
                <select name="currency-select" class="currency-select" aria-label="Currency preference:">
  <button class="btn-to-open-select">
    <selectedoption></selectedoption>
    <span class="arrow"></span>
  </button>
  <option value="eur">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/510px-Flag_of_Europe.svg.png" alt="" />
    <div class="currency">
      <div class="currency-short">EUR</div>
      <div class="currency-long">Euro</div>
    </div>
    <div class="symbol" aria-hidden="true">€</div>
  </option>
  <option value="gbp">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Flag_of_the_United_Kingdom_%281-2%29.svg/510px-Flag_of_the_United_Kingdom_%281-2%29.svg.png" alt="" />
    <div class="currency">
      <div class="currency-short">GBP</div>
      <div class="currency-long">Great British Pound</div>
    </div>
    <div class="symbol" aria-hidden="true">£</div>
  </option>
  <option value="usd" selected>
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Flag_of_the_United_States_%28DoS_ECA_Color_Standard%29.svg/510px-Flag_of_the_United_States_%28DoS_ECA_Color_Standard%29.svg.png" alt="" />
    <div class="currency">
      <div class="currency-short">USD</div>
      <div class="currency-long">United States Dollar</div>
    </div>
    <div class="symbol" aria-hidden="true">$</div>
  </option>
<option value="jpy">
    <img src="https://upload.wikimedia.org/wikipedia/en/thumb/9/9e/Flag_of_Japan.svg/510px-Flag_of_Japan.svg.png" alt="" />
    <div class="currency">
      <div class="currency-short">JPY</div>
      <div class="currency-long">Japanese Yen</div>
    </div>
    <div class="symbol" aria-hidden="true">¥</div>
  </option>
  <option value="bitcoin">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Bitcoin.svg/300px-Bitcoin.svg.png" alt="" />
    <div class="currency">
      <div class="currency-short">BTC</div>
      <div class="currency-long">Bitcoin</div>
    </div>
    <div class="symbol" aria-hidden="true">₿</div>
  </option>
</select>
              
            
!

CSS

              
                /* Enter into custom mode */

select,
::picker(select) {
  appearance: base-select;
}

/* remove checkmark  */
option::before {
  display: none;
}


/* Styling the options list */

::picker(select) {
  border-radius: 0.5rem;
  padding: 0;
}

option {
  grid-template-columns: 1.5rem 1fr auto;
  padding: 0.5rem 1rem;
  
  &:nth-child(even):not(:hover) {
    background: #ececec;
  }
  
  .symbol {
    margin-left: 1rem;
  }
  
  .currency-long {
    font-size: 80%;
    color: #595959;
  }
  
  .symbol {
    justify-self: end;
  }
}

/* Styles for both the options and selectedoption */

option,
selectedoption {
  display: grid;
  gap: 1rem;
  font-size: 1rem;
  align-items: center;
}

/* Style what you see before you open the select dropdown */

selectedoption {
  padding: 0.5rem;
  grid-template-columns: 1.5rem auto;
  
  .symbol,
  .currency-long {
    display: none
  }
}

.btn-to-open-select {
  border: none;
  border-radius: 0.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  padding: 0 1rem 0 0.5rem;
  width: 8.25rem;
  
  p {
    line-height: 0;
  }
}

.arrow {
  margin-left: 0.5rem;
  align-self: center;
  transition: rotate 0.25s;
  background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg id='Layer_1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 66.49 42.37'%3E%3Cdefs%3E%3Cstyle%3E .cls-1 %7B fill: %23221f20; stroke-width: 0px; %7D %3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M3.96,0h58.57c3.37,0,5.2,3.95,3.01,6.52l-29.28,34.46c-1.58,1.86-4.45,1.86-6.03,0L.95,6.52C-1.23,3.95.59,0,3.96,0Z'/%3E%3C/svg%3E");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(4);
    width: 0.5rem;
    height: 0.5rem;
  
  .currency-select:open & {
    rotate: x 180deg;
  }
}

/* etc */

[hidden] {
  display: none;
}

body {
  margin: 2rem 4rem;
}

img,
figure {
  width: 100%;
}
              
            
!

JS

              
                
              
            
!
999px

Console