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

              
                <p>Using just CSS to style <code>&lt;select&gt;</code> elements, on a cross-browser way.</p>

<select>
	<option>Browser default styles</option>
	<option>Option 1</option>
	<option>Option 2</option>
</select>

<select class="select-basic">
	<option>Sass mixin basic styles</option>
	<option>Option 1</option>
	<option>Option 2</option>
</select>

<select class="select-full">
	<option>Sass mixin full styles</option>
	<option>Option 1</option>
	<option>Option 2</option>
</select>

<h2>See also:</h2>
<ul>
  <li>
    <a href="https://super-simple.net/blog/cross-browser-select-sass-mixin/#browser-support">
    Browser support
    </a>
  </li>
  <li>
    <a href="https://codepen.io/supersimplenet/pen/VwLmbYE">
      Progressive enhancement drop-down
    </a>
  </li>
</ul>

<h2>More info:</h2>

<ul>
  <li>
    <a href="https://www.filamentgroup.com/lab/select-css.html">
      Styling a Select Like It’s 2019
    </a>
  </li>
  <li>
    <a href="https://codepen.io/kevinweber/pen/dXWoRw?editors=0100">
      URL-encoded Inline SVG using SCSS mixin (no Base64 needed)
    </a>
  </li>
</ul>
              
            
!

CSS

              
                // Sass utilities: https://codepen.io/supersimplenet/pen/xxZrZYa

@mixin select(
  $background: transparent,
  $caret: map-get($svg, angle-down),
  $caret-fill: null,
  $caret-width: .75em,
  $caret-background: transparent,
  $separator-width: 0px,
  $separator-color: transparent,
  $padding-y: .5rem,
  $padding-x: .5rem
){
  @content;
  
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;

  line-height: 1;
  cursor: pointer;
  
  &::-ms-expand {
    // Arrow icon in IE browsers
    display: none;
  }
 
  $padding-right: calc(#{$padding-x} + #{$separator-width} + #{$padding-x + #{$caret-width}} + #{$padding-x});

  @if ($caret-background == transparent and $separator-color == transparent and strip-unit($separator-width) == 0) {
    $padding-right: calc(#{$padding-x} + #{$separator-width} + #{$padding-x + #{$caret-width}});
  }

  @if ($caret-background == transparent) {
    $caret-background: linear-gradient(to bottom, transparent, transparent);
  }

  @if ($background == transparent) {
    $background: linear-gradient(to bottom, transparent, transparent);
  }

  @if ($separator-color == transparent) {
    $separator-color: linear-gradient(to bottom, transparent, transparent);
  }
    
  padding: $padding-y $padding-right $padding-y $padding-x;
  
  background-image:
    url(svg($caret, $caret-fill)),
    $caret-background,
    $separator-color,
    $background;
  background-repeat: no-repeat;
  background-position: 
    right $padding-x top 50%,
    right top,
    right calc(#{$padding-x} + #{$caret-width} + #{$padding-x}) top,
    right top;
  background-size:
    $caret-width 100%,
    calc(#{$padding-x} + #{$caret-width} + #{$padding-x}) 100%,
    $separator-width 100%,
    100%;
}

select {
  font: inherit;
  display: block;
  margin-bottom: 1rem;
  
  &.select-basic {
    @include select();
  }
  
  &.select-full {
    @include select(
      $background: linear-gradient(to bottom, #fff, #ddd),
      $caret: map-get($svg, caret-down),
      $caret-fill: #666,
      $caret-background: linear-gradient(to bottom, #eee, #ccc),
      $separator-width: 2px,
      $separator-color: linear-gradient(to bottom, #aaa, #aaa),
    ){
      border: 0;
      box-shadow: 0 0 5px gray;
      font-weight: bold;
      border-radius: .25em;
    };
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console