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.

            
              ul.items
 li.item Item A
 li.item Item B
 li.item Item C
 li.item Item D
 .selection.left
 .selection.right
            
          
!
            
              // Using http://colorhunt.co/c/10278

@import url(https://fonts.googleapis.com/css?family=Droid+Serif);

body, html
  margin: 0
  padding: 0
  width: 100%
  height: 100%

body
  display: flex
  flex-direction: row
  justify-content: center

.items
  position: relative
  display: block
  align-self: center
  padding: 0
  
  font-family: 'Droid Serif', serif;
  font-size: 22px
  color: #2B4450
  overflow: hidden
  
  .item
    display: inline-block
    border-top: 3px solid #497285
    border-bottom: 3px solid #497285
    min-width: 80px
    margin: 10px
    padding: 3px
    text-align: center
    transition: all 0.2s ease
    
    &:hover
      margin: 3px
      padding: 10px
      border-color: #F78536
      color: #F78536
    
  .selection
    content: ''
    position: absolute
    top: 13px
    &.left
      left: -110px
    &.right
      left: 110%
    display: block
    height: 1em
    width: 80px
    margin: 3px
    padding: 3px 10px
    background-color: #2B4450
    opacity: 0
    z-index: -1
    transition: all 0.8s, left 0.6s 0.1s
    transition-timing-funtion: ease-in
  
  .item:hover ~ .selection
    top: 3px
    left: 0
    padding: 12px 10px
    opacity: 1
    transition-delay: 0s
    transition-timing-funtion: ease-out
    
  for num in (1..10)
    .item:nth-child({num+1}):hover ~ .selection
      left: num * 112px
    
  
            
          
!
            
              # No JS this time, sorry...

###
Maybe it would be nice to add some JS that would change the selection's width based on the element's width, and the selection's left based on the position of that element. That would make it possible to have different sized items...
###
            
          
!
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