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

              
                form
  fieldset
    each val, i in ['Off', 'Control', 'Automatic', 'Manual']
      - var checked = i === 0 ? {'checked' : 'checked'} : ''
        
      input(type='radio', name='option', id=`option-${i + 1}`)&attributes(checked)
      label(for=`option-${i + 1}`) #{val}
    .dial
              
            
!

CSS

              
                $dial-size: 20vmin
$stroke-width: 0.5vmin
$stroke-margin: 1vmin
$label-spacing: 8vmin
$font-size: 4vmin
$col-fg: #333
$col-bg: #f5f5f5

*,
*::before,
*::after
  box-sizing: border-box
  margin: 0
  padding: 0
  border: 0

body
  width: 100vw
  height: 100vh
  display: flex
  align-items: center
  justify-content: center
  background-color: $col-bg
  color: $col-fg
  font:
    family: sans-serif
    size: $font-size
    weight: 100
  line-height: 1
  
fieldset
  display: block
  width: $dial-size
  height: $dial-size
  position: relative

input,
label,
.dial
  position: absolute

// LABELS and STROKES
label
  width: $dial-size
  left: 35vmin
  white-space: nowrap
  
  &::after
    content: ''
    width: 8.25vmin
    height: $stroke-width
    margin-right: $stroke-margin
    position: absolute
    top: #{($font-size - $stroke-width) / 2}
    right: 100%
    border-radius: #{$stroke-width * 0.5}
    background-color: $col-fg
  
  &[for='option-1']
    top: #{$label-spacing}
    left: #{$dial-size * -1.75}
    text-align: right
    
    &::after
      width: #{$dial-size * 0.6}
      left: 100%
      margin-left: $stroke-margin
    
  &[for='option-2']
    top: #{$label-spacing * -1}
    
  &[for='option-3']
    top: $label-spacing
    
    &::after
      width: #{$dial-size * 0.6}
    
  &[for='option-4']
    top: #{$label-spacing * 3}
    
  &[for='option-2']::before,
  &[for='option-4']::before
    content: ''
    width: 11vmin
    height: $stroke-width
    position: absolute
    top: #{($font-size - $stroke-width) / 2}
    left: #{$dial-size * -1}
    background-color: $col-fg
    transform-origin: right center
    
  &[for='option-2']::before
    transform: rotate(-45deg)
    
  &[for='option-4']::before
    transform: rotate(45deg)
    
// DIAL
.dial
  width: $dial-size
  height: $dial-size
  position: relative
  z-index: -1
  border-radius: 50%
  background-color: $col-fg
  transition: transform 600ms ease-out
  
  &::after
    content: ''
    width: #{$dial-size * 0.4}
    height: $stroke-width
    position: absolute
    top: #{($dial-size - $stroke-width) / 2}
    left: $stroke-margin
    border-radius: #{$stroke-width * 0.5}
    background-color: white

// rotate dial
#option-1:checked ~ .dial
  transform: rotate(0deg)
  
#option-2:checked ~ .dial
  transform: rotate(135deg)
  
#option-3:checked ~ .dial
  transform: rotate(180deg)
  
#option-4:checked ~ .dial
  transform: rotate(225deg)

// allow dial to be clicked
input
  appearance: none
    
  &::after
    content: ''
    display: block
    width: 0vmin
    height: 0vmin
    position: absolute
    z-index: 1
  
  input:checked + label + &::after
    width: $dial-size
    height: $dial-size
    z-index: 2
  
#option-1::after
  width: $dial-size
  height: $dial-size
  z-index: 1

              
            
!

JS

              
                
              
            
!
999px

Console