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="switch">
  <div class="body">
    <div class="volume"></div>
    <div class="screen">
      <div class="logo">
        <div class="icon">
          <div class="icon-part left"></div>
          <div class="icon-part right"></div>
        </div>
        <h1><span>Nintendo</span>Switch</h1>
      </div>
    </div>
  </div>
  
  <div class="joy-con left">
    <div class="button-group">
      <div class="button arrow up"></div>
      <div class="button arrow right"></div>
      <div class="button arrow down"></div>
      <div class="button arrow left"></div>
    </div>
    
    <div class="stick"></div>
    <div class="select"></div>
    <div class="capture"></div>
    <div class="shoulder l"></div>
  </div>
  
  <div class="joy-con right">
    <div class="button-group">
      <div class="button letter" data-letter="X"></div>
      <div class="button letter" data-letter="A"></div>
      <div class="button letter" data-letter="B"></div>
      <div class="button letter" data-letter="Y"></div>
    </div>
    
    <div class="stick"></div>
    <div class="start"></div>
    <div class="home"></div>
    <div class="shoulder r"></div>
  </div>
</div>
              
            
!

CSS

              
                html {
  box-sizing: border-box;
}

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

body {
  display: flex;
  height: 100vh;
  font-size: 2em;
  font-family: "Open Sans", sans-serif;
  background-color: #eee;
}

.switch {
  position: relative;
  z-index: 1;
  margin: auto;
}

.body {
  position: relative;
  width: 20.125em;
  height: 11.75em;
  padding: 0.375em 0.5625em;
  background-repeat: no-repeat;
  background-position: 0 0, 0 0, 100% 0;
  background-size: 100%, 51%, 51%;
  background-image:
    linear-gradient(
      to bottom,
      rgba(56,58,61,0) 50%,
      rgba(56,58,61,1) 50%
    ),
    radial-gradient(
      circle at 0 0,
      rgba(56,58,61,0) 0.5em,
      rgba(56,58,61,1) 0.515625em
    ),
    radial-gradient(
      circle at 100% 0,
      rgba(56,58,61,0) 0.5em,
      rgba(56,58,61,1) 0.515625em
    );
  border-radius: 0.125em;
  box-shadow:
    inset 0 -1.25em 0.5em -1em rgba(0,0,0,0.5);
}

.body::before,
.body::after {
  content: '';
  position: absolute;
  display: block;
}

.body::before {
  top: 0;
  left: 0.4375em;
  width: calc(100% - 0.875em);
  height: 0.3125em;
  background-image:
    linear-gradient(
      to bottom,
      rgba(255,255,255,0),
      rgba(255,255,255,0.25),
      rgba(255,255,255,0)
    );
}

.body::after {
  top: 0.5625em;
  left: 0;
  width: 100%;
  height: calc(100% - 0.5625em);
  border-radius: 0 0 0.125em 0.125em;
  box-shadow:
    inset 0.0625em 0 rgba(255,255,255,0.08),
    inset -0.0625em 0 rgba(255,255,255,0.08);
}

.volume {
  position: absolute;
  bottom: 100%;
  left: 2.625em;
  width: 1.6875em;
  height: 0.03125em;
  background-color: #555;
}

.volume::before,
.volume::after {
  content: '';
  position: absolute;
  bottom: 0;
  display: block;
  width: 36%;
  height: 0.0625em;
  background-color: #555;
  border-radius: 0.0625em 0.0625em 0 0;
  box-shadow: inset 0 0.03125em 0.03125em #333;
}

.volume::before {
  left: 0;
}

.volume::after {
  right: 0;
}

.screen {
  display: flex;
  box-sizing: content-box;
  position: relative;
  width: 16em;
  height: 9em;
  color: #fff;
  font-family: "Montserrat", sans-serif;
  background-color: #e60012;
  border: 1em solid #000;
  border-left-width: 1.5em;
  border-right-width: 1.5em;
  border-radius: 0.375em;
}

.logo {
  margin: auto;
  text-transform: uppercase;
}

.logo h1 {
  font-size: 1.0625em;
  letter-spacing: 0.125em;
}

.logo h1 span {
  display: block;
  font-size: 55%;
  letter-spacing: 0.40625em;
}

.icon {
  height: 3.3125em;
  margin-bottom: 0.4375em;
  text-align: center;
  animation: logo-icon 2s linear infinite;
}

.icon-part {
  position: relative;
  height: 100%;
  display: inline-block;
  margin: 0 0.03125em;
}

.icon-part.left {
  width: 1.59375em;
  border: 0.25em solid #fff;
  border-radius: 0.8125em 0 0 0.8125em;
}

.icon-part.right {
  width: 1.4375em;
  background-color: #fff;
  border-radius: 0 0.8125em 0.8125em 0;
  animation: logo-right 2s linear infinite;
}

.icon-part::before {
  content: '';
  position: absolute;
  left: 50%;
  display: block;
  width: 0.65625em;
  height: 0.65625em;
  transform: translateX(-50%);
  border-radius: 50%;
}

.icon-part.left::before {
  top: 0.46875em;
  background-color: #fff;
}

.icon-part.right::before {
  top: 1.5em;
  background-color: #e60012;
}

@keyframes logo-right {
  0% { transform: translateY(-40%); }
  25% { transform: translateY(-50%); }
  30% { transform: translateY(0); }
  70% { transform: translateY(0); }
  100% { transform: translateY(-40%); }
}

@keyframes logo-icon {
  0% { transform: translateY(0); }
  30% { transform: translateY(0); }
  35% { transform: translateY(10%); }
  40% { transform: translateY(0); }
  100% { transform: translateY(0); }
}

.joy-con {
  position: absolute;
  top: 0;
  width: 3.8125em;
  height: 100%;
  background-color: #83868d;
  backface-visibility: hidden;
  border: 0;
}

.joy-con.left {
  right: calc(100% + 0.03125em);
  border-radius: 2.5em 0.25em 0.125em 2.5em;
  box-shadow:
    inset 0.125em -0.125em 0.375em rgba(0,0,0,0.5),
    inset -0.3125em 0 0.0625em -0.25em rgba(0,0,0,0.25),
    inset 0.375em 0.5625em 0.5em -0.25em #83868d,
    0.40625em 0.25em 0 -0.375em #222;
}

.joy-con.left::before {
  content: '';
  position: absolute;
  top: 0.125em;
  left: 0.0625em;
  display: block;
  width: calc(100% - 0.0625em);
  height: 50%;
  border-radius: 2.5em 0.25em 0 0;
  box-shadow: inset 0.125em 0.3125em 0.125em -0.25em rgba(255,255,255,0.75);
  filter: blur(0.0625em);
}

.joy-con.right {
  left: calc(100% + 0.03125em);
  border-radius: 0.25em 2.5em 2.5em 0.125em;
  box-shadow:
    inset -0.125em -0.125em 0.375em rgba(0,0,0,0.5),
    inset 0.3125em 0 0.0625em -0.25em rgba(0,0,0,0.25),
    inset -0.375em 0.5625em 0.5em -0.25em #83868d,
    -0.40625em 0.25em 0 -0.375em #222;
}

.joy-con.right::before {
  content: '';
  position: absolute;
  top: 0.125em;
  right: 0.0625em;
  display: block;
  width: calc(100% - 0.0625em);
  height: 50%;
  border-radius: 0.25em 2.5em 0 0;
  box-shadow: inset -0.125em 0.3125em 0.125em -0.25em rgba(255,255,255,0.75);
  filter: blur(0.0625em);
}

.button-group {
  position: absolute;
  left: 50%;
  width: 45%;
  padding-bottom: 45%;
  transform: translateX(-50%);
}

.left .button-group {
  top: 5.375em;
  margin-left: 2.5%;
}

.right .button-group {
  top: 2.125em;
  margin-left: -2.5%;
}

.button {
  position: absolute;
  width: 0.75em;
  height: 0.75em;
  margin: -0.375em;
  color: rgba(255,255,255,0.6);
  background-color: #49494b;
  border-radius: 100%;
  box-shadow:
    inset 0 -0.0625em 0.125em rgba(0,0,0,0.75),
    inset 0 0.125em 0.125em -0.0625em rgba(255,255,255,0.4),
    0 0 0.03125em 0.0625em rgba(0,0,0,0.6),
    0 0.0625em 0.25em 0.03125em rgba(0,0,0,0.5);
  cursor: pointer;
}

.button:active {
  box-shadow:
    inset 0 -0.0625em 0.125em rgba(0,0,0,0.75),
    inset 0 0.125em 0.125em -0.0625em rgba(255,255,255,0.4),
    0 0 0.03125em 0.0625em rgba(0,0,0,0.6);
}

.button:nth-child(1) {
  top: 0;
  left: 50%;
}

.button:nth-child(2) {
  top: 50%;
  right: 0;
}

.button:nth-child(3) {
  bottom: 0;
  left: 50%;
}

.button:nth-child(4) {
  top: 50%;
  left: 0;
}

.button.arrow::before,
.button.arrow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 0.125em solid transparent;
  border-bottom: 0.25em solid rgba(255,255,255,0.1);
  border-top: none;
}

.button.arrow::after {
  top: calc(50% - 0.03125em);
  border-bottom: 0.25em solid #272b2d;
}

.button.arrow.right::before,
.button.arrow.right::after {
  margin-left: 0.03125em;
  transform: translate(-50%, -50%) rotate(90deg);
}

.button.arrow.down::before,
.button.arrow.down::after {
  margin-top: 0.03125em;
  transform: translate(-50%, -50%) rotate(180deg);
}

.button.arrow.left::before,
.button.arrow.left::after {
  margin-left: -0.03125em;
  transform: translate(-50%, -50%) rotate(270deg);
}

.button.letter::before {
  content: attr(data-letter);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.375em;
  line-height: 1;
}

.stick {
  position: absolute;
  left: 50%;
  width: 1.75em;
  height: 1.75em;
  margin: -0.375em;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  background-color: #49494b;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.0625em 100%, 100% 0.0625em, 100%;
  background-image:
    linear-gradient(
      to bottom,
      #222,
      #111
    ),
    linear-gradient(
      to bottom,
      #222,
      #333
    ),
    linear-gradient(
      to bottom,
      #666,
      #111
    );
  border-radius: 100%;
  box-shadow:
    inset 0 -0.0625em 0.125em rgba(0,0,0,0.75),
    inset 0 0.125em 0.125em -0.03125em rgba(0,0,0,0.2),
    inset 0 0.1875em 0.125em -0.0625em rgba(255,255,255,0.3),
    0 0 0.09375em 0.0625em rgba(0,0,0,0.75),
    0 0.375em 1em 0.0625em rgba(0,0,0,0.4);
  cursor: pointer;
}

.stick:active {
  box-shadow:
    inset 0 -0.0625em 0.125em rgba(0,0,0,0.75),
    inset 0 0.125em 0.125em -0.03125em rgba(0,0,0,0.2),
    inset 0 0.1875em 0.125em -0.0625em rgba(255,255,255,0.3),
    0 0 0.09375em 0.0625em rgba(0,0,0,0.75),
    0 0.375em 0.75em 0.0625em rgba(0,0,0,0.4);
}

.stick::before,
.stick::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 75%;
  height: 75%;
  transform: translate(-50%,-50%);
  background-repeat: no-repeat;
  background-position: center;
  background-image:
    linear-gradient(
      to bottom,
      #666,
      #222
    );
  border-radius: 50%;
  box-shadow: inset 0 0 0.125em rgba(255,255,255,0.08);
}

.stick::before {
  width: 85%;
  height: 85%;
  background-size: 0.0625em 100%, 100% 0.0625em, 100%;
  background-image:
    linear-gradient(
      to bottom,
      #444,
      #111
    ),
    linear-gradient(
      to bottom,
      #222,
      #333
    ),
    linear-gradient(
      to bottom,
      #222,
      #666
    );
  box-shadow: none;
}

.left .stick {
  top: 2.5em;
  margin-left: 2.5%;
}

.right .stick {
  top: 5.75em;
  margin-left: -2.5%;
}

.select,
.start {
  position: absolute;
  background-color: #49494b;
  cursor: pointer;
}

.select {
  top: 1.125em;
  right: 0.375em;
  width: 0.625em;
  height: 0.1875em;
  border-radius: 0.03125em;
  box-shadow:
    inset 0 -0.03125em 0.0625em rgba(0,0,0,0.5),
    inset 0 0.03125em rgba(255,255,255,0.2),
    0 0 0.03125em 0.03125em rgba(0,0,0,0.6),
    0 0.09375em 0.125em -0.03125em rgba(0,0,0,0.4);
}

.select:active {
  box-shadow:
    inset 0 -0.03125em 0.0625em rgba(0,0,0,0.5),
    inset 0 0.03125em rgba(255,255,255,0.2),
    0 0 0.03125em 0.03125em rgba(0,0,0,0.6),
    0 0.09375em 0.125em -0.03125em rgba(0,0,0,0.15);
}

.start {
  top: 0.90625em;
  left: 0.5625em;
  width: 0.1875em;
  height: 0.625em;
  box-shadow:
    0 0 0.03125em 0.03125em rgba(0,0,0,0.6),
    0 0.09375em 0.125em -0.03125em rgba(0,0,0,0.4);
}

.start::before,
.start::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  transform: translate(-50%,-50%);
  background-color: #49494b;
  border-radius: 0.03125em;
}

.start::before {
  width: 0.625em;
  height: 0.1875em;
  box-shadow:
    inset 0 -0.03125em 0.0625em rgba(0,0,0,0.5),
    inset 0 0.03125em rgba(255,255,255,0.2),
    0 0 0.03125em 0.03125em rgba(0,0,0,0.6),
    0 0.09375em 0.125em -0.03125em rgba(0,0,0,0.4);
}

.start::after {
  width: 0.1875em;
  height: 0.625em;
  box-shadow:
    inset 0 -0.09375em 0.0625em -0.0625em rgba(0,0,0,0.5),
    inset 0 0.03125em rgba(255,255,255,0.2);
}

.start:active {
  box-shadow:
    0 0 0.03125em 0.03125em rgba(0,0,0,0.6),
    0 0.09375em 0.125em -0.03125em rgba(0,0,0,0.15);
}

.start:active::before {
  box-shadow:
    inset 0 -0.03125em 0.0625em rgba(0,0,0,0.5),
    inset 0 0.03125em rgba(255,255,255,0.2),
    0 0 0.03125em 0.03125em rgba(0,0,0,0.6),
    0 0.09375em 0.125em -0.03125em rgba(0,0,0,0.15);
}

.capture {
  position: absolute;
  bottom: 2.875em;
  right: 0.8125em;
  width: 0.6875em;
  height: 0.6875em;
  background-color: #444;
  border-radius: 0.09375em;
  box-shadow:
    inset 0 0.25em 0.5em -0.0625em rgba(255,255,255,0.1),
    inset 0 0.015625em 0.03125em -0.015625em rgba(255,255,255,0.5),
    inset 0 0 0.03125em rgba(0,0,0,1),
    0 0.015625em 0 0.03125em rgba(0,0,0,0.75);
  cursor: pointer;
}

.capture::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  Height: 70%;
  transform: translate(-50%,-50%);
  background-color: #3b3f40;
  border-radius: 50%;
  box-shadow:
    inset 0 0.0625em 0.0625em -0.03125em rgba(0,0,0,0.75),
    inset 0 -0.03125em 0.03125em -0.03125em rgba(255,255,255,0.5);
}

.capture:active {
  box-shadow:
    inset 0 0.25em 0.5em -0.0625em rgba(255,255,255,0.1),
    inset 0 0.015625em 0.03125em -0.015625em rgba(255,255,255,0.5),
    inset 0 0 0.03125em rgba(0,0,0,1),
    0 0.015625em 0 0.03125em rgba(0,0,0,0.5);
}

.home {
  position: absolute;
  bottom: 2.8125em;
  left: 0.75em;
  width: 0.875em;
  height: 0.875em;
  background-color: #444;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 0.09375em #83868d,
    inset 0 0.25em 0.5em -0.0625em rgba(255,255,255,0.1),
    inset 0 0.015625em 0.03125em -0.015625em rgba(255,255,255,0.5),
    inset 0 0 0.03125em rgba(0,0,0,1),
    0 0.015625em 0.03125em 0.0625em rgba(0,0,0,0.65);
  cursor: pointer;
}

.home::before,
.home::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  transform: translate(-50%,-50%);
}

.home::before {
  width: 0.3125em;
  height: 0.25em;
  margin-top: 0.03125em;
  background-color: #444;
  box-shadow:
    inset 0 0 0 0.078125em #111,
    inset 0.109375em 0 0 #111,
    inset -0.109375em 0 0 #111,
    0 0.0625em 0 -0.03125em rgba(255,255,255,0.08);
}

.home::after {
  margin-top: -0.125em;
  border-right: 0.21875em solid transparent;
  border-left: 0.21875em solid transparent;
  border-bottom: 0.1875em solid #111;
}

.home:active {
  box-shadow:
    inset 0 0 0 0.09375em #83868d,
    inset 0 0.25em 0.5em -0.0625em rgba(255,255,255,0.1),
    inset 0 0.015625em 0.03125em -0.015625em rgba(255,255,255,0.5),
    inset 0 0 0.03125em rgba(0,0,0,1),
    0 0 0.015625em 0.0625em rgba(0,0,0,0.6);
}

.shoulder {
  position: absolute;
  z-index: -1;
  top: -0.125em;
  display: block;
  width: 5.5em;
  height: 2.5em;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 100%;
  border-radius: 5em 5em 0 0;
  cursor: pointer;
}

.shoulder.l {
  left: -0.125em;
  background-image:
    radial-gradient(
      circle at 3em 0.125em,
      rgba(15,15,15,1) 0.125em,
      rgba(15,15,15,0) 0.15125em
    ),
    radial-gradient(
      circle at 0.34375em 1.5em,
      rgba(15,15,15,1) 0.125em,
      rgba(15,15,15,0) 0.15125em
    ),
    radial-gradient(
      circle at 0.875em -0.625em,
      rgba(68,68,68,1) 1.75em,
      rgba(15,15,15,1) 2.15625em,
      rgba(15,15,15,0) 2.1875em
    );
}

.shoulder.l:active {
  top: -0.0625em;
  left: -0.0625em;
}

.shoulder.r {
  right: -0.125em;
  background-image:
    radial-gradient(
      circle at 2.5em 0.125em,
      rgba(15,15,15,1) 0.125em,
      rgba(15,15,15,0) 0.15125em
    ),
    radial-gradient(
      circle at 5.1875em 1.5em,
      rgba(15,15,15,1) 0.125em,
      rgba(15,15,15,0) 0.15125em
    ),
    radial-gradient(
      circle at 4.5em -0.625em,
      rgba(68,68,68,1) 1.75em,
      rgba(15,15,15,1) 2.15625em,
      rgba(15,15,15,0) 2.1875em
    );
}

.shoulder.r:active {
  top: -0.0625em;
  right: -0.0625em;
}
              
            
!

JS

              
                
              
            
!
999px

Console