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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                h1 Pure CSS Select

.jelect
  each n in [0, 1, 2, 3, 4]
    input.jelect-input(
      id='jelectOption' + n
      type='radio'
      name='option'
      value=n
      tabindex=0
      checked=n === 0
    )
  .jelect-toggle.jelect-toggle_type_open(tabindex=0)
  .jelect-toggle.jelect-toggle_type_close(tabindex=0)
  .jelect-options(tabindex=0)
    each n in [0, 1, 2, 3, 4]
      label.jelect-option(
        for='jelectOption' + n
      )= n === 0 ? 'Select option' : 'Option ' + n
              
            
!

CSS

              
                *
  box-sizing border-box

h1
  margin-top 40px
  margin-bottom 40px
  font-family 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif
  font-size 36px
  text-align center

.jelect
  position relative
  z-index 1
  margin-left auto
  margin-right auto
  width 300px
  height 50px
  user-select none

  &-toggle
    position absolute
    z-index 2
    top 0
    left 0
    right 0
    cursor pointer

    &:focus
      outline none

    &_type_open
      bottom 0

    &_type_open:focus
    &_type_close
      bottom auto

    &_type_open:focus + &_type_close
      bottom 0

  &-input
    position absolute

  &-options
    position absolute
    z-index 1
    top 0
    left 0
    right 0
    padding-top 50px
    overflow hidden
    height 50px
    background-color #fff
    box-shadow 0 0 10px rgba(0, 0, 0, .25)

    &:focus
      outline none

  &-option
    padding-left 20px
    padding-right 20px
    display block
    height 50px
    font-family 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif
    font-size 14px
    line-height 50px
    cursor pointer
    transition-duration .25s
    transition-property background-color
    will-change background-color

    &:hover
      background-color #ffffcc

  &-toggle_type_open:focus ~ &-options
  &-options:focus
    height auto

  for i in 1...10
    &-input:nth-child({i}):checked ~ &-options &-option:nth-child({i})
      position absolute
      top 0
      left 0
      right 0


              
            
!

JS

              
                
              
            
!
999px

Console