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

              
                
<div class="container">
  <h1 class="title">CSS Flexbox Apple Keyboard by <a href="//olex.co/">Olex</a></h1>
  <div class="keyboard">
    <div class="keyboard-row thin">
      <div class="key lowercase">Esc</div>
      <div class="key function lo-bright"><span>f1</span></div>
      <div class="key function hi-bright"><span>f2</span></div>
      <div class="key function expose"><span>f3</span></div>
      <div class="key function tilez"><span>f4</span></div>
      <div class="key function"><span>f5</span></div>
      <div class="key function"><span>f6</span></div>
      <div class="key function rewind"><span>f7</span></div>
      <div class="key function play-pause"><span>f8</span></div>
      <div class="key function ffwd"><span>f9</span></div>
      <div class="key function mute"><span>f10</span></div>
      <div class="key function lo-vol"><span>f11</span></div>
      <div class="key function hi-vol"><span>f12</span></div>
      <div class="key eject"></div>
    </div>
    <div class="keyboard-row">
      <div class="key"><span>~<br/>`</span></div>
      <div class="key"><span>!<br/>1</span></div>
      <div class="key"><span>@<br/>2</span></div>
      <div class="key"><span>#<br/>3</span></div>
      <div class="key"><span>$<br/>4</span></div>
      <div class="key"><span>%<br/>5</span></div>
      <div class="key"><span>^<br/>6</span></div>
      <div class="key"><span>&amp;<br/>7</span></div>
      <div class="key"><span>*<br/>8</span></div>
      <div class="key"><span>(<br/>9</span></div>
      <div class="key"><span>)<br/>0</span></div>
      <div class="key"><span>_<br/>-</span></div>
      <div class="key"><span>+<br/>=</span></div>
      <div class="key extra-size lowercase lower-right"><span class="lower-row-text">delete</span></div>
    </div>
    <div class="keyboard-row">
      <div class="key extra-size lowercase lower-left"><span class="lower-row-text">tab</span></div>
      <div class="key">Q</div>
      <div class="key">W</div>
      <div class="key">E</div>
      <div class="key">R</div>
      <div class="key">T</div>
      <div class="key">Y</div>
      <div class="key">U</div>
      <div class="key">I</div>
      <div class="key">O</div>
      <div class="key">P</div>
      <div class="key"><span>{<br/>[</span></div>
      <div class="key"><span>}<br/>]</span></div>
      <div class="key"><span>|<br/>\</span></div>
    </div>
    <div class="keyboard-row">
      <div class="key lowercase lower-left extra-size-two"><span class="lower-row-text">caps lock</span><span class="absolute-left caps-dot">&bull;</span></div>
      <div class="key">A</div>
      <div class="key">S</div>
      <div class="key">D</div>
      <div class="key">F</div>
      <div class="key">G</div>
      <div class="key">H</div>
      <div class="key">J</div>
      <div class="key">K</div>
      <div class="key">L</div>
      <div class="key"><span>:<br/>;</span></div>
      <div class="key"><span>"<br/>'</span></div>
      <div class="key extra-size-two lowercase lower-right"><span class="lower-row-text">return</span><span class="absolute-right">enter</span></div>
    </div>
    <div class="keyboard-row">
      <div class="key double-size lowercase lower-left"><span class="lower-row-text">shift</span></div>
      <div class="key">Z</div>
      <div class="key">X</div>
      <div class="key">C</div>
      <div class="key">V</div>
      <div class="key">B</div>
      <div class="key">N</div>
      <div class="key">M</div>
      <div class="key"><span>&lt;<br/>,</span></div>
      <div class="key"><span>&gt;<br/>.</span></div>
      <div class="key"><span>?<br/>/</span></div>
      <div class="key double-size lowercase lower-right"><span class="lower-row-text">shift</span></div>
    </div>
    <div class="keyboard-row bottom-row">
      <div class="key lower-left lowercase"><span class="lower-row-text">fn</span></div>
      <div class="key lower-left lowercase"><span class="lower-row-text">control</span></div>
      <div class="key lower-left lowercase"><span class="lower-row-text">option</span><span class="absolute-left">alt</span></div>
      <div class="key lower-center lowercase extra-size-two"><span class="lower-row-text">command</span><span class="absolute-right icon">&#8984;</span></div>
      <div class="key space-bar"></div>
      <div class="key lower-center lowercase extra-size-two"><span class="lower-row-text">command</span><span class="absolute-left icon">&#8984;</span></div>
      <div class="key lower-right lowercase"><span class="lower-row-text">option</span><span class="absolute-right">alt</span></div>
      <div class="arrows">
          <div class="key">&#9668;</div>
          <div class="up-down">
            <div class="key">&#9650;</div>
            <div class="key">&#9660;</div>
          </div>
          <div class="key">&#9658;</div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                * {
  box-sizing: inherit;
}
body {
  box-sizing: border-box;
  background-color: #404049;
  font-family:'VAG Rounded W01 Thin';
}

.container {
  max-width: 816px;
  padding: 30px 8px 8px;
  margin: 60px auto;
  box-shadow: inset 1px 1px 0px #f1f1f1, 3px 3px 6px 3px #303038;
  background-color: #e3e3e3;
  border-radius: 1px 1px 7px 7px;
}

h1 {
  position: relative;
  top: -23px;
  left: 3px;
  height: 0;
  font-size: 12px;
  a {
    color: inherit;
    text-decoration: none;
    letter-spacing: 0.5px;
    &:hover {
      color: #ff8855;
      border-bottom: 1px solid;
    }
  }
}

.keyboard-row {
  display: flex;
}

@key-height: 30px;
.key {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  text-align: center;
  padding: 3px 2px;
  height: @key-height;
  margin: 4px;
  letter-spacing: 0.5px;
  color: #3a3a3a;
  background-color: #f7f7f7;
  flex: 1;
  box-shadow: 
        inset 0 -2px 0 #aaaaaa,
    inset 0px 1px 1px -1px #fff,
        0px 1px 1px 0px #7a7a7a;
  border-radius: 3px;
  text-transform: uppercase;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  transition:
    transform 0.08s ease,
    background-color 0.08s ease,
    box-shadow 0.08s ease;
  cursor: pointer;
  
  &:hover {
    background-color: #fbfbfb;
  }
  
  &:active {
    transform: translateY(1.5px);
    box-shadow: 
        inset 0 -0.5px 0 #aaaaaa,
    inset 0px -1px 1px -1px #fff,
        0px 0.5px 0.75px 0px #999;
  }
  
  span {
    display: inline-block;
    vertical-align: middle;
  }
  
  &::before {
    display: inline-block;
    vertical-align: middle;
    height: 100%;
    content: '';
  }
  
  .keyboard-row.thin & {
    height: 20px; 
  }
  .keyboard-row.bottom-row & {
    height: 24px; 
  }
  
  @media (min-width: 640px) {
    height: 48px;
    .keyboard-row.thin & {
      height: 28px; 
    }
    .keyboard-row.bottom-row & {
      height: 55px; 
    }
  }
  
  &.extra-size {
    flex: 1.25;
  }
  &.extra-size-two {
    flex: 1.625;
  }
  &.double-size {
    flex: 2.125;
  }
  
  &.lowercase {
    font-size: 11px;
    text-transform: lowercase;
  }
  
  &.function {
    font-size: 8px;
    text-align: right;
  }
  
  &.function span {
    vertical-align: bottom;
  }
  
  &.lower-right {
    vertical-align: bottom;
    text-align: right;
    padding-right: 5px;
  }
  &.lower-left {
    vertical-align: bottom;
    text-align: left;
    padding-left: 5px;
  }
  &.lower-center {
    vertical-align: bottom;
  }
  
  &.space-bar {
    flex: 7.2;
  }
  
  .lower-row-text {
    vertical-align: bottom;
    padding-bottom: 2px;
  }
  
  .absolute-left ,
  .absolute-right {
    position: absolute;
    top: 5px;
    font-size: 9px;
    &.icon {
      font-size: 12px;
    }
  }
  .absolute-right {
    right: 5px;
  }
  .absolute-left {
    left: 5px;
    &.caps-dot {
      top: 3px;
      left: 4px;
    }
  }
}

.bottom-row .arrows {
  display: flex;
  flex: 4;
  justify-content: justify;
  align-items: flex-end;
  padding-bottom: 4px;
  
  .up-down {
    flex: 1.2;
    height: 54px;
    display: flex;
    flex-direction: column;
    margin-left: 4px;
    margin-right: 4px;

    .key {
      margin: 0;
    }
    
    .key:first-child {
      box-shadow: inset 0 -5px 4px -4px #aaaaaa,
            inset 0px 1px 1px -1px #fff,
        0px 1px 1px 0px #7a7a7a;
      border-bottom-left-radius: 1px;
      border-bottom-right-radius: 1px;
    }
    .key + .key {
      
      border-top-left-radius: 1px;
      border-top-right-radius: 1px;
    }
  }
  
  .key {
    flex: 1;
    font-size: 7px;
    margin: 0 4px;
    height: 27px;
    font-family: "Georgia", sans-serif;
    color: #555;
  }
}

/* function row icons */
.fn-row-icon {
  background-size: auto 60%;
  background-position: 50% 45%;
  background-repeat: no-repeat;
}

.eject, .lo-bright, .hi-bright, .expose, .tilez, .rewind, .ffwd, .play-pause, .mute, .lo-vol, .hi-vol, .eject {
  .fn-row-icon;
}

.rewind, .play-pause, .mute, .lo-vol, .hi-vol, .eject {
}

.eject {
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-01_1.svg);
}
.lo-bright {
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-10_1.svg);
}
.hi-bright {
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-09_1.svg);
}
.expose{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-08_1.svg);
}
.tilez{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-07_1.svg);
}
.rewind{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-06_1.svg);
}
.ffwd{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-04_1.svg);
}
.play-pause{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-05_1.svg);
}
.mute{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-11.svg);
}
.lo-vol{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-03_1.svg);
}
.hi-vol{
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-02_1.svg);
}
.eject {
  background-image: url(//s3-us-west-2.amazonaws.com/s.cdpn.io/8533/apple-icons-01_1.svg);
}



              
            
!

JS

              
                
              
            
!
999px

Console