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

              
                input(type="checkbox", id="onoff")

#notice This replica of the SA-20 has sound, but it only works on Google Chrome... 
  b Don't forget to turn the power on!

#keyboard
  each speaker in ["left", "right"]
    .speaker(id="speaker-"+speaker)
      .circle
      .bar.bar-top
      - var n = 0;
      while n < 5
        .bar
        - n++;
      .bar.bar-mid
      - var n = 0;
      while n < 12
        .bar
        - n++;
      .bar.bar-bottom
  #nav-top.nav
    #casio CASIO
      span SA-2O
    #onehundred.bluetext 100
      span sound
    #tonebank.bluetext 
      span.larger T
      span O
      span.together NE
      span.larger B
      span A
      span.together NK
    ol
      each mode in ["Piano", "Elec Piano", "Honkey-Tonk Piano", "Harpsichord", "Jazz Organ", "Elec Organ", "Pipe Organ", "Church Organ", "Street Organ", "Accordion", "Brass Ens", "Warm Brass", "Trumpet","Tuba", "Brass Hit", "Wind Ens", "English Horn", "Oboe", "Bassoon", "Clarinet", "Samba Whistle", "Whistle", "Quena", "Flute", "Flute Vib", "Ocarina", "Bagpipe", "Harmonica", "Chorus", "Brass-Strings", "Strings", "Warm Strings", "Violin", "Violin-Piano", "Cello", "Elec Guitar", "Jazz Guitar", "Mute Guitar", "Metal Guitar", "Blap Bass", "Elec Bass", "Mood Bass", "Snare Bass", "Ukulele", "Banjo", "Sitar", "Mandolin", "Harp", "Taishokoto", "Shamisen", "Synth-Piano", "Synth-Celesta", "Synth-Claw", "Synth-Accordion", "Synth-Brass", "Synth-Heed", "Synth-Lead", "Synth-Strings", "Synth-Guitar", "Synth-Bass", "Glass Harmonica", "Fantasy", "WAW Voice", "Twinkle Echo", "Metal Lead", "Cathedral", "Cosmic Dance", "Plunk Extend", "Pop Lead", "Pearl Drop", "Airplane", "Ambulance", "Insect", "Emergency Alarm", "Laser Beam", "Cosmic Sound", "Telephone", "Car Horn", "Computer Sound", "Typewriter", "Vibraphone", "Marimba", "Church Bells", "Bells","Gamelan", "Afro Percussion", "Ethnic Percussion", "Sample Percussion", "Matsuri", "Wadaiko", "Triangle", "Conga/Agogo", "Cowbell/Clave", "Tom", "Rock Drum", "Swing Drum", "Bass/Piano", "Bass/Trumpet", "Piano/Flute", "Strings/Oboe"]
        li #{mode}
    #powertext.text POWER
    #offontext.text OFF _ _ ON
    #pulse.text
      span P
      | ulse
      span C
      | ode
      span M
      | odulation
    #volume.text Volume
    #rythm.text RYTHM/SUPER ACCOMPANIMENT
    #volume-symbols.text
    #demo.text DEMO
    #tone.text TONE
    #tones
      - var n = 0;
      while n < 10
        .tone= (n++)
    #tempo.text TEMPO
    #select.text SELECT
    #stop.text STOP
  #nav-mid.nav(style="color:#e0e0e0")
    #super «SUPER ACCOMPANIMENT»
    #sa-rythm RHYTHM
    #green-lines
    #white-lines
    #line1
      each sa in ["rock", "pops", "funk", "slow-rock", "latin", "jungle", "orient", "bagpiper", "fanfare", "childs-play", "classical", "computer", "new-age-music"]
        div(id="sa-"+sa) #{sa}
    #line2
      each sa in ["rock1", "rock2", "16-beat-1", "16-beat-2", "disco-1", "disco-2", "disco-3", "pops-1", "pops-2", "pops-3", "slow-rocK", "swing", "march", "reggae", "tango", "samba", "bossa-nova", "beguine", "waltz"]
        div(id="sa-"+sa) #{sa}
  #button-section
    label.onoff(for="onoff")
      - var n = 0;
      while n < 12
        .line
        - n++;
    #blue-buttons
      - var n = 0;
        while n < 10
          .holder
            label.button
            .sound
              embed(src="https://studiokah.com/tests/keyboard-key.mp3")
          - n++;
    #other-buttons
      - var n = 0;
        while n < 7
          .holder
            label.button
            .sound
              embed(src="https://studiokah.com/tests/keyboard-key.mp3")
          - n++;
  #keys
    - var n = 0;
    while n < 32
      label.key(class="key"+(n++))
    .sound
      embed(src="https://studiokah.com/tests/keyboard-key.mp3")
    - var n = 0;
    #keysounds 
      each val in [0,2,4,6,7,9,11,12,14,16,18,19,21,23,24,26,28,30,31,1,3,5,8,10,13,15,17,20,22,25,27,29]
        .keysound
          embed(src="https://studiokah.com/tests/piano/keyboard-32-"+val+".mp3")
    
              
            
!

CSS

              
                $gray-1: lighten(#363534, 5%); //#4e5255;
$gray-2: lighten(#252525, 5%);
$gray-3: #363534;
$gray-4: #c0c0c0;
$yellow: #eebb66;
$green: #44ccaa;
$white: #fbfaf5;
$letters: #abb8c9;
$blue: #6688cc;

@import url('https://fonts.googleapis.com/css?family=Orbitron:700|Play|Squada+One|Kanit:900');

html, body {
  font-family: arial, verdana, sans-serif;
}

#notice { font-size: 10px;}

input,
.sound,
.keysound {
  display: none;
  position: absolute;
  width: 0;
  top: -10000px;
  top: -100vmax;
}

#keyboard {
  width: 1000px;
  height: 287px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  overflow: hidden;
  &::after {
    content: "";
    z-index: -1;
    position: absolute;
    top: 2px;
    left: 6px;
    bottom: 0px;
    right: 6px;
    background: $gray-3;
    box-shadow: inset 0 0 8px 2px rgba(0, 0, 0, 1), inset 0 0 11px white, inset 0 0 3px rgba(0, 0, 0, 1);
  }
  .speaker {
    position: absolute;
    width: 182px;
    height: 100%;
    z-index:3;
    &::before, &::after {
      content: "";
      position: absolute;
      z-index: -1;
      position: absolute;
      top: 5px;
      left: 2px;
      right: 2px;
      height: 70px;
      background: $gray-3;
    }
    &::after {
      top: auto;
      bottom: 5px;
      height: 170px;
    }
    .circle {
      position: absolute;
      width: 130px;
      height: 130px;
      background: rgba(0,0,0,0.4);
      left: 26px;
      bottom: 26px;
      border-radius: 130px;
      &::before, &::after {
        content: "";
        position: absolute;
        left: 35px;
        top: 0;
        width: 8px;
        height: 100%;
        background: $gray-2;
      }
      &::after {
        left: auto;
        right: 35px;
      }
    }
    .bar {
      position: relative;
      width: 182px;
      height: 11px;
      background: $gray-1;
      border-radius: 2px;
      margin-top: 2px;
      box-shadow: inset 0 1px 1px lighten($gray-1, 15%), inset 0 -1px 1px darken($gray-1, 20%), inset 3px 3px 1px lighten($gray-1, 10%), inset 0 -3px 3px darken($gray-1, 10%), 2px 1px 2px rgba(0,0,0,0.5);
      &:nth-child(n+7) {
        //box-shadow: inset 0 1px 1px lighten($gray-1, 25%), inset 0 -1px 1px darken($gray-1, 30%), 2px -1px 2px rgba(0,0,0,0.5);
        box-shadow: inset 0 1px 1px lighten($gray-1, 15%), inset 0 -1px 1px darken($gray-1, 20%), inset 3px 3px 1px lighten($gray-1, 10%), inset 0 -3px 3px darken($gray-1, 10%), 2px 0px 2px rgba(0,0,0,0.5);
      }
      &.bar-top {
        height: 13px;
        margin-top: 0;
        border-radius: 20px 4px 4px 4px;
      }
      &.bar-mid {
        height: 12px;
        margin-top: 27px;
      }
      &.bar-bottom {
        height: 13px;
        border-radius: 4px 4px 4px 20px;
      }
    }
    &#speaker-right {
      right: 0;
      .bar {
        //box-shadow: inset 0 1px 2px lighten($gray-1, 20%), inset 0 -1px 2px darken($gray-1, 20%), -2px 1px 2px rgba(0,0,0,0.5);
        box-shadow: inset 0 1px 1px lighten($gray-1, 15%), inset 0 -1px 1px darken($gray-1, 20%), inset 3px 3px 1px lighten($gray-1, 10%), inset 0 -3px 3px darken($gray-1, 10%), -2px 1px 2px rgba(0,0,0,0.5);
        &:nth-child(n+7) {
          //box-shadow: inset 0 1px 2px lighten($gray-1, 20%), inset 0 -1px 2px darken($gray-1, 20%), -2px -1px 2px rgba(0,0,0,0.5);
          box-shadow: inset 0 1px 1px lighten($gray-1, 15%), inset 0 -1px 1px darken($gray-1, 20%), inset 3px 3px 1px lighten($gray-1, 10%), inset 0 -3px 3px darken($gray-1, 10%), -2px 0px 2px rgba(0,0,0,0.5);
        }
        &.bar-top {
          height: 13px;
          border-radius: 4px 20px 4px 4px;
        }
        &.bar-bottom {
          height: 13px;
          border-radius: 4px 4px 20px 4px;
        }
      }
    }
  }
  .nav {
    position: relative;
    left: 184px;
    background: $gray-2;
    width: 632px;
    border-radius: 2px;
    box-shadow: inset 1px 1px 1px lighten($gray-2, 25%),  inset 0 -2px 1px darken($gray-2, 10%), 0 1px 2px rgba(0,0,0,0.5);
    z-index: 2;
    &#nav-top {
      border-radius: 2px 2px 1px 1px;
      height: 78px;
      .text {
        position: absolute;
        font-weight: bold;
        opacity: 0.8;
        font-size: 5.5px;
      }
      #casio {
        position: absolute;
        left: 20px;
        top: 8px;
        font-family: Orbitron;
        font-weight: bold;
        color: $letters;
        opacity: 0.8;
        font-size: 14px;
        span {
          font-weight: lighter;
          margin-left: 6px;
          //font-size: 0.8em;
          font-family: play;
        }
      }
      .bluetext {
        position: absolute;
        font-family: kanit, play, arial, sans-serif;
        color: $blue;
        opacity: 0.66;
        text-transform: uppercase;
        font-style: italic;
        font-weight: bold;
        left: 20px;
        font-size: 18px;
        &#onehundred {
          top: 19px;
          span {
            font-size: 0.7em;
            margin-left: 5px;
          }
        }
        &#tonebank {
          top: 30px;
          span {
            //letter-spacing: -1px;
            &.together {
              letter-spacing: -5px;
              margin-right: 6px;
            }
            &.larger {
              font-size:1.2em;
            }
          }
        }
      }
      ol {
        top: 8px;
        right: 8px;
        position: absolute;
        list-style: none;
        padding-left: 0;
        margin: 0;
        padding: 0;
        color: $letters;
        counter-reset: modes 0;
        font-size: 3.25px;
        font-weight: bold;
        column-count: 10;
        opacity: 0.8;
        text-transform: uppercase;
        li {
          &::before {
            content: counter(modes, decimal-leading-zero);
            color: $blue;
            margin-right: 2px;
          }
          &::after {
            counter-increment: modes;
            content: "";
          }
        }
      }
      #powertext {
        color: $yellow;
        bottom: 12px;
        left: 8px;
      }
      #offontext {
        color: $gray-4;
        font-size: 5px;
        bottom: 4px;
        left: 6px;
      }
      #pulse {
        color: $gray-4;
        bottom: 12px;
        left: 111px;
        span {
          color: $yellow;
          font-size: 6px;
          font-weight: bold;
          margin-left: 2px;
        }
      }
      #volume, #rythm, #tone {
        color: $yellow;
        bottom: 12px;
        left: 195px;
        text-transform: uppercase;
      }
      #rythm {
        left: 275px;
        font-size: 5.5px;
      }
      #tone {
        left: 499px;
      }
      #volume-symbols {
        position: absolute;
        bottom: 4px;
        left: 192px;
        color: $gray-4;
        opacity: 0.8;
        font-size: 5px;
        &::before {
          content: "▼";
        }
        &::after {
          content: "▲";
          padding-left: 20px;
        }
      }
      #demo {
        position: absolute;
        bottom: 10px;
        left: 238px;
        display: inline-block;
        font-size: 5.5px;
        background: $yellow;
        font-weight: bold;
        padding: 2px 1.5px;
        border-radius: 1px;
        opacity: 0.8;
      }
      #tones {
        position: absolute;
        right: 0;
        bottom: 4px;
        width: 250px;
        display: flex;
        .tone {
          text-align: center;
          -webkit-flex: 1;
          flex: 1;
          color: $gray-4;
          font-size: 5px;
          opacity: 0.8;
        }
      }
      #tempo {
        color: $gray-4;
        font-size: 5px;
        bottom: 4px;
        left: 274px;
        &::before {
          margin-right: 2px;
          display: inline-block;
          content: "▼";
        }
        &::after {
          content: "▲";
          display: inline-block;
          margin-left: 2px;
        }
      }
      #select, #stop {
        bottom: 4px;
        left: 317px;
        color: $gray-4;
      }
      #stop {
        left: 346px;
      }
    }
    &#nav-mid {
      margin-top: 27px;
      height: 30px;
      #super, #sa-rythm {
        position: absolute;
        color: $green;
        font-family: "Squada One", Play, arial, sans-serif;
        font-size: 10px;
        opacity: 0.8;
        top: 6px;
        left: 12px; 
      }
      #sa-rythm {
        color: $gray-4;
        left: auto;
        right: 12px;
        font-family: Arial;
        font-size:7px;
        top: auto;
        bottom: 8px;
      }
      #green-lines, #white-lines {
        position: absolute;
        top: 12px;
        left: 5px;
        width: 0;
        height: 7px;
        border-left: 1px solid $green;
        opacity: 0.6;
        &::before, &::after {
          content:"";
          display: block;
          position: absolute;
          top:0;
          left: 0;
          width: 5px;
          height: 0;
          border-top: 1px solid $green;
        }
        &::after {
          top: auto;
          bottom: 0;
          width: 560px;
        }
      }
      #white-lines {
        left: auto;
        right: 5px;
        height: 7px;
        top: 18px;
        border-left: 1px solid $gray-4;
        &::before, &::after {
          border-top: 1px solid $gray-4;
          left: auto;
          right: 0px;
        }
        &::after {
          width: 620px;
        }
      }
      #line1, #line2 {
        font-size: 4px;
        color: $green;
        position: absolute;
        bottom: 9px;
        color: $green;
        opacity: 0.8;
        width: 600px;
        height: 0;
        div {
          position: absolute;
          top: -4px;
          line-height: 4px;
          display: inline-block;
          background: $gray-2;
          text-transform: uppercase;
          transform: translate(-50%, 0);
          padding: 0px 2px;
          white-space: nowrap;
        }
      }
      #line2 {
        bottom: 4px;
        color: $gray-4;
        div {
          top: -3px;
        }
      }
      #sa-rock { left: 4.9%; }
      #sa-pops { left: 11%; }
      #sa-funk { left: 16.8%; }
      #sa-slow-rock { left: 27%; }
      #sa-latin { left: 33.4%; }
      #sa-jungle { left: 43.4%; }
      #sa-orient { left: 49.6%; }
      #sa-bagpiper { left: 56.1%; }
      #sa-fanfare { left: 66%; }
      #sa-childs-play { left: 72.3%; }
      #sa-classical { left: 82.5%; }
      #sa-computer { left: 88.4%; }
      #sa-new-age-music { left: 94.7%; }
      #sa-rock1 { left: 12px; }
      #sa-rock2 { left: 8%;}
      #sa-16-beat-1 { left: 13.8%; }
      #sa-16-beat-2 { left: 19.6%; }
      #sa-disco-1 { left: 24%; }
      #sa-disco-2 { left: 30.2%; }
      #sa-disco-3 { left: 36.6%; }
      #sa-pops-1 { left: 40.4%; }
      #sa-pops-2 { left: 46.6%; }
      #sa-pops-3 { left: 52.6%; }
      #sa-slow-rocK { left: 58.6%; }
      #sa-swing { left: 62.9%; }
      #sa-march { left: 69%; }
      #sa-reggae { left: 75.4%; }
      #sa-tango { left: 79.3%; }
      #sa-samba { left: 85.5%; }
      #sa-bossa-nova { left: 91.8%; }
      #sa-beguine { left:98%; }
      #sa-waltz { left: 102.2%; }
    }
  }
  #keys {
    position: relative;
    left: 184px;
    background: $gray-2;
    width: 632px;
    border-radius: 2px;
    box-shadow: inset 1px 1px 1px lighten($gray-2, 25%),  inset 0 -2px 1px darken($gray-2, 10%), 0 1px 2px rgba(0,0,0,0.5);
    z-index: 2;
    height: 145px;
    border-radius: 0;
    display: flex;
    z-index:1;
    .key {
      display: block;
      -webkit-flex: 1;
      flex:1;
      margin-right: 1px;
      border-radius: 0px 0px 3px 3px;
      background: $white;
      //box-shadow: inset 0px -8px 3px -7px darken($white, 40%), inset 0 -5px 1px darken($white, 20%), inset 0px -13px 0px -7px white, inset 2px 5px 3px rgba(255,255,255,0.25), inset 0px 3px 0 darken($white, 20%), 0 0 1px 0 darken($white, 20%); 
      box-shadow: inset 0px -2px 2px -0px darken($white, 40%),  inset 0px -13px 0px -7px white, inset 2px 5px 3px rgba(255,255,255,0.25), inset 0px 3px 0 darken($white, 20%), 0 0 1px 0 darken($white, 20%);
      transition: all 0.25s;
      &:hover {
        cursor: pointer;
      }
      &:active {
        //box-shadow: inset 0 -2px 1px darken($white, 20%), inset 0px 3px 0 darken($white, 20%), 0 0 1px 0 darken($white, 20%);
        //box-shadow: inset 0px -2px 3px -0px darken($white, 40%), inset 0 -1px 1px darken($white, 20%), inset 0px -13px 0px -7px white, inset 2px 5px 3px rgba(255,255,255,0.25), inset 0px 3px 0 darken($white, 20%), 0 0 1px 0 darken($white, 20%);
        box-shadow: inset 0px -1px 3px -0px darken($white, 40%),  inset 0px -9px 0px -3px white, inset 2px 5px 3px rgba(255,255,255,0.25), inset 0px 3px 0 darken($white, 20%), 0 0 1px 0 darken($white, 20%);
      }
      &:last-child {
        margin-right: 0;
      }
      &:nth-child(n+20) {
        position: absolute;
        top: 0;
        height: 85px;
        width: 18px;
        background: #1e1e1e;
        border-radius: 0 0 3px 3px;
        box-shadow: none;
        transform: translate(-50%, 0);
        box-shadow: inset 0 -5px 1px black, inset 2px 5px 3px rgba(255,255,255,0.25), inset 0px 3px 0 black, 0 0 1px 0px black; 
        &:active {
          box-shadow: inset 0 -1px 1px 0 black, inset 2px 5px 3px rgba(255,255,255,0.25), inset 0px 3px 0 black, 0 0 1px 0px black;
        }
      }
      $percentages: (4.7, 10.4, 16, 25.8, 31.8, 41.3, 47.2, 53.3, 62.6, 68.6, 78.4, 84, 90);
      @for $i from 1 through 13 {
        &:nth-child(#{$i + 19}) { left: nth($percentages, $i) * 1%; }
      }
    }
  }
  #button-section {
    position: absolute;
    top: 78px;
    left: 184px;
    width: 632px;
    height: 25px;
    z-index: 1;
    .onoff {
      position: absolute;
      top: 4px;
      bottom: 1px;
      left: 5px;
      background: $gray-4;
      width: 30px;
      overflow: hidden;
      box-shadow: 1px 2px 2px rgba(0,0,0,0.5), 0 0 1px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.5);
      cursor: pointer;
      //transform: translate(0,0);
      transition: all 0.15s;
      .line {
        position: relative;
        float: left;
        width: 2px;
        height: 100%;
        box-shadow: 1px 0 0 rgba(255,255,255,0.2), -1px 0 0 rgba(0,0,0,0.2), inset 0 1px 1px rgba(255,255,255,0.5);
        &:nth-child(n+7) {
          float: right;
        }
      }
    }
    .button {
      display: block;
      width: 8px;
      height: 21px;
      background: $blue;
      margin: auto auto;
      margin-top: 4px;
      box-shadow: inset 0 -1px 1px black, inset 1px 1px 2px rgba(255,255,255,0.25), inset 0px 0px 0 black, 0 0 1px 0px black, 1px 1px 1px rgba(0,0,0,0.5); 
      cursor: pointer;
      &:active {
        box-shadow: inset 0 -1px 1px black, inset 1px 1px 2px rgba(255,255,255,0.25), inset 0px 0px 0 black, 0 0 1px 0px black, 0px 0px 1px rgba(0,0,0,0.1); 
      }
    }
    #blue-buttons {
      position: absolute;
      right: 0;
      width: 250px;
      height: 100%;
      display: flex;
      .holder {
        -webkit-flex: 1;
        flex:1;
      }
    }
    #other-buttons {
      position: absolute;
      right: 267px;
      width: 183px;
      height: 100%;
      display: flex;
      .holder {
        -webkit-flex: 1;
        flex: 1;
        .button {
          background: $yellow;
        }
        &:nth-child(n+4) {
          .button {
            background: $green;
          }
        }
        &:nth-child(3), &:nth-child(2) {
          margin-right: 4px;
        }
      }
    }
  }
}

@media all and (max-width:1000px) {
  #keyboard {
    transform: translate(-50%, -50%) scale(0.6);
  }
}

// actions when a label is clicked or activated
#onoff {
  &:checked {
    ~ #keyboard .onoff {
      left: 9px;
    }
    ~ #keyboard #button-section {
      label:active ~ .sound {
        display: block;
      }
    }
    
    //TODO: Add all the notes in MP3 or whatever!
    @for $i from 0 through 31 {
      ~ #keyboard #keys label:nth-child(#{$i + 1}):active ~ #keysounds .keysound:nth-child(#{$i + 1}) {
        display: block;
      }
    }
  }
  &:not(:checked) {
    ~ #keyboard {
      label:active ~ .sound {
        display: block;
      }
    }
  }
}

@media all and (max-width:600px) {
  #keyboard {
    transform: translate(-50%, -50%) scale(0.4);
  }
}

@media all and (max-width:414px) {
  #keyboard {
    transform: translate(-50%, -50%) scale(0.35);
  }
}
              
            
!

JS

              
                // No JS. Just display.
              
            
!
999px

Console