123

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              - const colors = ['#0088FF', '#FFAA00', '#FF7700', '#FF0033', '#9911AA', '#AADD22']
.container
  - for (let b = 0; b < colors.length; b++)
    button(role='button' tabindex='0' style=`--buttonColor: ${colors[b]}`) Boo!
      span
      span
      span
      span
      b(aria-hidden='true') Boo!
      b(aria-hidden='true') Boo!
      b(aria-hidden='true') Boo!
      b(aria-hidden='true') Boo!
            
          
!
            
              *
*:after
*:before
  box-sizing border-box

:root
  --bg #fafafa

body
  display flex
  align-items center
  justify-content center
  min-height 100vh
  background var(--bg)
  color var(--bg)
  font-family -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif

.container
  display grid
  grid-template-columns 1fr 1fr
  grid-gap 20px

button
  --borderWidth 5
  --boxShadowDepth 8
  --buttonColor red
  --fontSize 3
  --horizontalPadding 16
  --verticalPadding 8
  background transparent
  border calc(var(--borderWidth) * 1px) solid var(--buttonColor)
  box-shadow calc(var(--boxShadowDepth) * 1px) calc(var(--boxShadowDepth) * 1px) 0 #888
  color var(--buttonColor)
  cursor pointer
  font-size calc(var(--fontSize) * 1rem)
  font-weight bold
  outline transparent
  padding calc(var(--verticalPadding) * 1px) calc(var(--horizontalPadding) * 1px)
  position relative
  transition box-shadow .15s ease

  &:hover
    box-shadow calc(var(--boxShadowDepth) / 2 * 1px) calc(var(--boxShadowDepth) / 2 * 1px) 0 #888

  &:active
    box-shadow 0 0 0 #888

  span
    -webkit-clip-path var(--clip)
    bottom calc(var(--borderWidth) * -1px)
    clip-path var(--clip)
    left calc(var(--borderWidth) * -1px)
    position absolute
    right calc(var(--borderWidth) * -1px)
    top calc(var(--borderWidth) * -1px)
    z-index 1

    &:nth-of-type(1):hover
    &:nth-of-type(2):hover
    &:nth-of-type(3):hover
    &:nth-of-type(4):hover
      --clip polygon(0 0, 100% 0, 100% 100%, 0 100%)
      z-index 2

    &:nth-of-type(1):hover ~ b:nth-of-type(1)
    &:nth-of-type(2):hover ~ b:nth-of-type(2)
    &:nth-of-type(3):hover ~ b:nth-of-type(3)
    &:nth-of-type(4):hover ~ b:nth-of-type(4)
        --clip inset(0 0 0 0)

    &:nth-of-type(1)
      --clip polygon(0 0, 100% 0, 50% 50%, 50% 50%)
    &:nth-of-type(2)
      --clip polygon(100% 0, 100% 100%, 50% 50%)
    &:nth-of-type(3)
      --clip polygon(0 100%, 100% 100%, 50% 50%)
    &:nth-of-type(4)
      --clip polygon(0 0, 0 100%, 50% 50%)

  b
    -webkit-clip-path var(--clip)
    background var(--buttonColor)
    border calc(var(--borderWidth) * 1px) solid var(--buttonColor)
    bottom calc(var(--borderWidth) * -1px)
    font-weight bold
    clip-path var(--clip)
    color var(--bg, #fafafa)
    left calc(var(--borderWidth) * -1px)
    padding calc(var(--verticalPadding) * 1px) calc(var(--horizontalPadding) * 1px)
    position absolute
    right calc(var(--borderWidth) * -1px)
    top calc(var(--borderWidth) * -1px)
    transition clip-path .25s ease

    &:nth-of-type(1)
      --clip inset(0 0 100% 0)
    &:nth-of-type(2)
      --clip inset(0 0 0 100%)
    &:nth-of-type(3)
      --clip inset(100% 0 0 0)
    &:nth-of-type(4)
      --clip inset(0 100% 0 0)
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console