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

              
                <div class="position-center">
  
  <div class="select-wrapper select--dark">
    <select name="demo">
      <option value="pure">pure</option>
      <option value="css">css</option>
      <option value="bitch">bitch</option>
    </select>
  </div>
  
  <div class="select-wrapper select--white">
    <select name="demo">
      <option value="pure">pure</option>
      <option value="css">css</option>
      <option value="bitch">bitch</option>
    </select>
  </div>
  
</div>

              
            
!

CSS

              
                /*
Author: @gijsroge
Description: Pure CSS styled select elements that use pseudo elements to make it visually consistent in all modern browsers. Looks good in: Firefox, Chrome, Safari, IE10+. Other browsers will have multiple down arrows for example. But this is only visual stuff, everything still works as expected of course.
*/


/******************************* 
         demo styles 
*******************************/
*,*:after,*:before{
  box-sizing: border-box;
}

.position-center{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  
  .select-wrapper{
    margin: 0 20px;
  }
}



/******************************* 
        Styles to copy
*******************************/

/*
* Basic resets for select element
*/
.select-wrapper{
  select{
    width: auto;
    -webkit-appearance: none; 
    -moz-appearance: none; 
    -ms-appearance: none; 
    appearance: none;
    
    &::-ms-expand {
      display: none; /*IE10*/
    }
    
    border: none;
    outline: none;
    border-radius: 0; /*IOS*/
  }
}


/*
* Global styles
*/
.select-wrapper{
  display: inline-block;
  position: relative;
  
  &:after{
    content:'';
    position: absolute;
    height: 100%;
    right: 0;
    top: 0;
    pointer-events: none;
    background-position: left center;
  }
  
  &:before{
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
    pointer-events: none;
    text-align: center;
    z-index: 2;
  }
}


/******************************* 
          Dark theme
*******************************/
.select--dark{
  /*
   * Customize options
   */
  $radius: 0px;
  $basecolor: #302432;
  $border: #302432;
  $color: white;
  $padding: 20px;
  $arrowWidth: 35px;
  $transition: 100ms all cubic-bezier(0.250, 0.460, 0.450, 0.940);
  
  &:after,select{
    color: $color;
    background-color: $basecolor;
    transition: $transition;
  }
  
  &:after{
    width: $arrowWidth;
    border: 1px solid $border;
    border-radius: 0 $radius $radius 0;
    border-left: 0; 
  }
  
  // before psuedo child is used to display the down arrow
  &:before{
    color: $color;
    right: $padding;
    content:'▾';
  }
  
 /*
  * Hover styles
  */
  &:hover{
    &:after,select{
      background-color: darken($basecolor, 10%);
    }
  }
  
 /*
  * Select element
  */
  select{
    padding: ($padding/2) $padding;
    padding-right: $arrowWidth;
    border: 1px solid $border;
    border-radius: $radius;
    color: $color;
  }
}


/******************************* 
          White theme
*******************************/
.select--white{
  /*
   * Customize options
   */
  $radius: 20px;
  $basecolor: #fff;
  $border: #000;
  $color: black;
  $padding: 20px;
  $arrowWidth: 35px;
  $transition: 100ms all cubic-bezier(0.250, 0.460, 0.450, 0.940);
  
  &:after,select{
    color: $color;
    background-color: $basecolor;
    transition: $transition;
  }
  
  &:after{
    width: $arrowWidth;
    border: 1px solid $border;
    border-radius: 0 $radius $radius 0;
    border-left: 0; 
  }
  
  // before psuedo child is used to display the down arrow
  &:before{
    color: $color;
    right: $padding;
    content:'▾';
  }
  
 /*
  * Hover styles
  */
  &:hover{
    &:after,select{
      background-color: darken($basecolor, 10%);
    }
  }
  
 /*
  * Select element
  */
  select{
    padding: ($padding/2) $padding;
    padding-right: $arrowWidth;
    border: 1px solid $border;
    border-radius: $radius;
    color: $color;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console