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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="c-keyboard">
    
    <div class="c-keys--white">
      <div class="c-key"><svg viewbox="0 0 103 422" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M.996 14.213 102.544.413 76.007 421.115H13.516L.996 14.213Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 103 422" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M102.456 407.886.908 421.686 27.445.984h62.491l12.52 406.902Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 102 422" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M101.914 407.315.366 421.115 26.903.413h62.491l12.52 406.902Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 103 422" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M.538 14.783 102.086.983 75.549 421.687H13.057L.537 14.783Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 102 421" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M.254 14.088 101.802.288 75.265 420.99H12.773L.253 14.088Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 97 421"  fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m96.254 407.19-86.802 13.8L.96.288h73.49L96.255 407.19Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 96 422"  fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 13.8 86.801 0l8.493 420.702h-73.49L0 13.8Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 114 423" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m113.361 399.108-99.825 23.184L.832.945h78.682l33.847 398.163Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 113 423" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M.091 23.99 99.916.808l12.704 421.347H33.938L.091 23.991Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 89 435"  fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m88.907 434.278-88.49-8.996L7.021 3.795 69.442.84l19.465 433.439Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 90 435"  fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m.545.821 88.49 8.996-6.604 421.486-62.421 2.957L.545.821Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 114 422" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.992.413h103.704l-41.84 420.702H.285L9.992.413Z" fill="#fff"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 115 422" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M104.46 421.686H.756L42.596.984h71.57l-9.706 420.702Z" fill="#fff"/></svg></div>
    </div>
    
    <div class="c-keys--black">
      <div class="c-key"><svg viewbox="0 0 78 252" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M.24 1.436 71.599.573l6.382 250.364-56.786.687L.241 1.436Z" fill="#000"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 68 254" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M67.13.892.438 2.86l1.51 250.368 53.072-1.565L67.13.893Z" fill="#000"/></svg></div>
      <div class="c-key"></div>
      <div class="c-key"><svg viewbox="0 0 67 254" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M66.823.77.131 2.737l1.51 250.369 53.072-1.565L66.823.771Z" fill="#000"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 49 257" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m5.443.563 43.085 6.392-13.834 249.701L.407 251.57 5.443.563Z" fill="#000"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 53 255" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m.095.698 51.854 3.148.414 250.175-41.265-2.505L.095.698Z" fill="#000"/></svg></div>
      <div class="c-key"></div>
      <div class="c-key"><svg viewbox="0 0 63 279" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M59.986 278.443.02 272.153 14.293.108l47.722 5.005-2.029 273.33Z" fill="#000"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 62 275" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M61.974 274.865 7.4 272.46.888.187l43.428 1.914 17.658 272.764Z" fill="#000"/></svg></div>
      <div class="c-key"></div>
      <div class="c-key"><svg viewbox="0 0 55 279" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M54.923 278.16.57 272.722 9.216.508 52.47 4.835l2.453 273.325Z" fill="#000"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 64 274" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m63.877 273.883-54.354-5.438L.412 12.699 61.424.56l2.453 273.324Z" fill="#000"/></svg></div>
      <div class="c-key"><svg viewbox="0 0 64 252" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m.08.345 58.765 1.408 4.713 250.216-46.764-1.12L.081.345Z" fill="#000"/></svg></div>
    </div>

  </div>

              
            
!

CSS

              
                :root {
  --keys-nb: 13;
  --background-color: #37B2C3;
  --white-hover: #ffd200;
  --black-hover: #f40082;
  --keyboard-width: 80vw;
  --keyboard-height: 50vh;
  --key-width: calc(100 / var(--keys-nb) * 1%);
  --key-height: var(--keyboard-height);
  --white-key-margin: 2px;
  --black-key-width: 0.66; /* of white key */
  --black-key-margin: calc( (var(--key-width) - (var(--key-width) * var(--black-key-width))) / 2);
}
body {
  background-color: var(--background-color);
  display:flex;
  flex-direction: column;
  justify-content: center;
}
.c-keyboard {
  width:var(--keyboard-width);
  height:var(--keyboard-height);
  margin: 0 auto;
  position:relative;
  overflow: visible;
}
.c-key {
  height: var(--key-height);
  margin:0 var(--key-margin);
  transition: background-color 0.1s ease-in-out;
  overflow: visible;
}
.c-key:hover,
.c-key:focus,
.c-key svg:hover,
.c-key svg:focus {
  cursor: pointer;
}
.c-keys--white,
.c-keys--black {
  display:flex;
  flex-direction: row;
  justify-content: flex-start;
  position: absolute;
  top:0;
  left:0;
  width:100%;
  overflow: visible;
}
.c-keys--white {
}
.c-keys--black {
  margin-top:calc( var(--key-width) / -3);
  margin-left:calc( var(--key-width) / 2);
}
.c-keys--white .c-key {
  /* background-color: white; */
  margin:0 var(--white-key-margin);
  flex:1;
}
.c-keys--black .c-key {
  /* background-color: black; */
  margin:0 var(--black-key-margin);
  height: calc(var(--key-height) / 3 * 2);
  flex: 1 1 calc(var(--key-width) / 3 * 2);
}
.c-keys--white .c-key:nth-of-type(2)  svg { transform: rotate(-5.34deg); }
.c-keys--white .c-key:nth-of-type(3)  svg { transform: rotate(-2.71deg); }
.c-keys--white .c-key:nth-of-type(5)  svg { transform: rotate(-180deg); }
.c-keys--white .c-key:nth-of-type(6)  svg { transform: rotate(-180deg); }
.c-keys--white .c-key:nth-of-type(9)  svg { transform: rotate(-180deg); }
.c-keys--white .c-key:nth-of-type(10) svg { transform: rotate(177.29deg); }
.c-keys--white .c-key:nth-of-type(11) svg { transform: rotate(174.66deg); }
.c-keys--white .c-key:nth-of-type(12) svg { transform: rotate(-180deg); }

.c-keys--black .c-key:nth-of-type(1)  svg { transform: rotate(-5.34deg); }
.c-keys--black .c-key:nth-of-type(2)  svg { transform: matrix(-1, -0.06, -0.06, 1, 0, 0); }
.c-keys--black .c-key:nth-of-type(3)  svg { visibility: hidden; }
.c-keys--black .c-key:nth-of-type(4)  svg { transform: rotate(0.82deg); }
.c-keys--black .c-key:nth-of-type(5)  svg { transform: rotate(-4.27deg); }
.c-keys--black .c-key:nth-of-type(6)  svg { transform: matrix(-1, -0.06, -0.06, 1, 0, 0); }
.c-keys--black .c-key:nth-of-type(7)  svg { visibility: hidden; }
.c-keys--black .c-key:nth-of-type(8)  svg { transform: rotate(-2.91deg); }
.c-keys--black .c-key:nth-of-type(9)  svg { transform: rotate(-180deg); }
.c-keys--black .c-key:nth-of-type(10) svg { visibility: hidden; }
.c-keys--black .c-key:nth-of-type(11) svg { transform: rotate(-180deg); }
.c-keys--black .c-key:nth-of-type(12) svg { transform: rotate(179.1deg); }
.c-keys--black .c-key:nth-of-type(13) svg { transform: rotate(179.1deg); }

.c-keys--white svg path {
  transition: fill .15s ease-in-out;
}
.c-keys--black svg path {
  transition: fill .1s ease-in-out;
}
.c-keys--white .c-key svg:hover path,
.c-keys--white .c-key svg:focus path {
  fill: var(--white-hover);
}
.c-keys--black .c-key svg:hover path,
.c-keys--black .c-key svg:focus path {
  fill: var(--black-hover);
}
/* 
  clip-path is always overflow:hidden
*/
/*
.c-keys--white .c-key:nth-of-type(1) {
  clip-path: polygon(0 15%, 88% 0, 100% 91%, 6% 91%);
}
.c-keys--white .c-key:nth-of-type(2) {
  clip-path: polygon(-10% 10%, 100% 0%, 78% 105%, 10% 101%);
}
.c-keys--white .c-key:nth-of-type(3) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(4) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(5) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(6) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(7) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(8) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(9) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(10) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(11) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(12) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
.c-keys--white .c-key:nth-of-type(13) {
  clip-path: polygon(0% 0%, 100% 0, 100% 100%, 0 100%);
}
*/
              
            
!

JS

              
                
              
            
!
999px

Console