Pen Settings



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


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


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.


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.


                mixin layerR(n, c)
  if --n
      each type, position in {"zero":"number","one":"number","two":"number","three":"number","four":"number","five":"number","six":"number","seven":"number","eight":"number","nine":"number","plus":"operator","minus":"operator","multiply":"operator","equals":"operator"}
        if (position == "equals")
          input(type="radio" name=position class=position+' '+type).button
          input(type="radio" name=`buttons${n}` class=position+' '+type).button
      input(type="reset" class="reset" value="C" form="container").button
      if n == 1
          input(type="radio" name="equals" class="equals operator").button
          input(type="reset" class="reset" value="C" form="container").button
            input(type="reset" class="reset" value="C" form="container").button
              - for (index=0;index<c;index++)
      +layerR(n, c)

mixin layer(n)
  +layerR(n + 1, n)


                @import url('')
$buttons: ("zero":"0","one":"1","two":"2","three":"3","four":"4","five":"5","six":"6","seven":"7","eight":"8","nine":"9","plus":"+","minus":"-","multiply":"*","equals":"=")
@mixin layerR($n, $i, $c)
  @if $n != 0
      --checked#{$i}: initial
      --not-checked#{$i}: #{" "}
      --is-operator#{$i}: initial
      --is-not-operator#{$i}: #{" "}
      --is-number#{$i}: initial
      --expression#{$i}: + 0
      &>.number:checked ~ .layer
        --is-number#{$i}: #{" "}
        &:not(.equals):checked ~ .layer
          --is-operator#{$i}: #{" "}
          --is-not-operator#{$i}: initial
      @each $name,$symbol in $buttons
        @if $name != "equals"
            &:checked ~ .layer
              --symbol#{$i}: #{$symbol} 
              --char#{$i}: "#{$symbol}"
              --checked#{$i}: #{" "}
              --not-checked#{$i}: initial
    @if $n == 1
        $valid: ()
        $equation: ()
        @for $j from 1 to $c + 1
          --expression#{$j}: var(--is-operator#{$j - 1}, var(--is-operator#{$j}, var(--plus))) var(--symbol#{$j}) var(--is-operator#{$j}, var(--multiply) var(--power#{$j}))
          $power: ""
          $term: "var(--is-operator#{$c + 1})"
          @for $k from $j to $c + 1   
            $power: "var(--is-operator#{$c - ($k - $j) + 1}, var(--not-checked#{$c - ($k - $j) + 1}, var(--times-ten) #{$power}))"
            $term: "var(--is-operator#{$c - ($k - $j)}, var(--not-checked#{$c - ($k - $j)}, var(--expression#{$c - ($k - $j)}) #{$term}))"
          --power#{$j}: calc(#{"1 " + $power})
          --term#{$j}: calc(#{$term})

          --T2#{$j}: var(--is-operator#{$j - 1}) var(--term#{$j})
          --F2#{$j}: var(--is-operator#{$j - 1}, var(--blank))
          --term-or-blank#{$j}: var(--T2#{$j}, var(--F2#{$j}))

          --T3#{$j}: var(--is-operator#{$j}) var(--expression#{$j})
          --F3#{$j}: var(--is-operator#{$j}, var(--term-or-blank#{$j}))
          --final#{$j}: var(--T3#{$j}, var(--F3#{$j}))
          $equation: append($equation, var(--final#{$j}))
          $valid: append($valid, var(--is-not-operator#{$j}, var(--is-number#{$j - 1}) var(--is-number#{$j + 1})))

        --equation: #{$equation}
        --valid: #{$valid}

          @for $i from 1 to $c + 1
              content: var(--submit, var(--char#{$i}))

    @include layerR($n - 1, $i + 1, $c)
@mixin layer($n)
  --blank: #{" "}
  --plus: +
  --multiply: *
  --times-ten: * 10
  --submit: initial
  --is-operator0: #{" "}
  --is-operator#{$n + 1}: #{" "}
  --is-number0: initial
  --is-number#{$n + 1}: initial
  @include layerR($n, 1, $n)
  width: 100vw
  height: 100vh
    width: 100%
    height: 100%
    display: flex
    box-sizing: border-box
      box-sizing: inherit

  --width: 100vmin
  --break-point: clamp(0px, var(--width) - 500px, 50vmin)
  width: calc(var(--width) - var(--break-point) - 2%)
  height: calc((var(--width) - var(--break-point)) * (60/50))
  border: 1px solid black
  margin: auto
  position: relative
  overflow: hidden
  border-radius: 5%
  font-size: var(--width)
  @include layer(7)
  width: 100%
  height: 100%
  position: absolute
  display: grid
  grid-template-columns: repeat(4, 24%)
  grid-template-rows: repeat(5, 19.25%)
  grid-template-areas: "answer answer answer answer" "seven eight nine plus" "four five six minus" "one two three multiply" "blank zero reset equals"
  grid-gap: 1% 1.5%
  padding: 6% 3% 4%
  &:not(.container > .layer)
    pointer-events: none
      opacity: 0
    & > .button
      opacity: 0
    content: ''
    position: absolute
    width: 100%
    height: 100%
    background-color: white

  display: flex
  justify-content: flex-end
  align-items: center
  grid-area: answer
  border: 0.025em solid black
  padding: 0 1.5%
  max-width: 100%
  transform: translatey(-5%)
  font: calc((100% - var(--break-point)) * (28/100)) "VT323", monospace
  letter-spacing: min(0.04em, 4px)
  line-height: 0.5
    counter-reset: convert calc(var(--equation))
    --placeholder: var(--submit, var(--checked1, "0"))
    --answer: var(--valid) var(--submit) counter(convert)
    --error: var(--valid, var(--submit) "ERROR")
    content: var(--placeholder) var(--answer, var(--error))
    margin-right: var(--valid, var(--submit) auto)
    transform: inherit
  flex: 0 1
  transform: inherit
  width: 100% 
  height: 100%
  margin: 0
  border: 0.04em solid rgba(0,0,0,0.5)
  appearance: none
  font: calc((100% - var(--break-point)) * (11.5/100)) "Open Sans"
  display: flex
  justify-content: center
  align-items: center
  border-radius: 15%
  color: rgba(0,0,0,0.75)
  position: relative
  -webkit-tap-highlight-color: transparent
  user-select: none
    grid-area: blank
    background-color: rgba(0,0,0,0.25)
    grid-area: reset
    background-color: white
    padding: 0
      content: 'foo'
      width: 100px
      height: 100px
      background: blue
      display: block
      position: absolute
  @each $name, $symbol in $buttons
      grid-area: #{$name}
        content: $symbol
    & ~ .reset
      box-shadow: inset 0 0 0 0.05em rgba(0,0,255,0.6)
    & ~ .layer
      & .last
        pointer-events: auto
      & .answer
        --submit: #{" "}
    opacity: 0
    & ~ .layer
      pointer-events: auto
        opacity: 1
      & > .button
        opacity: 1
    background-color: rgba(0,0,255,0.25)
    cursor: pointer
    outline: none