css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              .wrapper
  #search-box
    %input#term
    %label.screen-reader{ :for=>"term" } Search
    #icon
  %article 
    %p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent faucibus dapibus pellentesque. Vestibulum quam massa, adipiscing vitae sollicitudin eu, suscipit sed leo. Nunc et diam tellus, id posuere mauris. Cras mollis est id metus molestie pretium. Ut sit amet magna nec felis ultricies vestibulum nec a nunc. Vestibulum eros felis, dapibus eu imperdiet ut, fermentum vitae dui. Cras sem nisi, faucibus eu vulputate eu, consectetur dignissim neque. Sed ut enim quis ligula posuere tempus. Etiam lectus nibh, vestibulum blandit tincidunt id, pharetra ac ligula. Curabitur auctor orci at augue bibendum vestibulum. In venenatis nulla nec ipsum euismod non dictum purus dictum.
    %p Aliquam vel massa sed leo pulvinar ultrices nec et leo. Maecenas vel turpis sapien. Etiam varius, purus a laoreet euismod, augue odio gravida urna, viverra adipiscing dui libero vel elit. Nam vehicula risus sed ipsum rhoncus scelerisque. Nullam a dui neque, a tincidunt felis. Nullam eget libero turpis, sit amet commodo sem. Duis at velit ut massa tincidunt vulputate a mollis velit. Ut eu convallis nisi. Sed fringilla libero eu mi convallis nec laoreet magna euismod. Maecenas mauris nisl, pulvinar vel dictum ut, pharetra at augue. Fusce ipsum lorem, pulvinar et fringilla eget, porta a neque. In ornare nunc non nulla congue ut scelerisque sapien congue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas gravida venenatis est, vel tempor est congue vitae.
    %p Nunc sed pellentesque lacus. Vestibulum at mauris nisi. Aliquam condimentum, leo vitae porta tincidunt, mauris mi condimentum libero, et lacinia lacus erat in purus. Sed et hendrerit nisi. Quisque viverra urna eget odio lacinia sit amet auctor odio dapibus. Morbi sit amet nisi nec leo ornare dignissim ac vel metus. Donec magna leo, convallis eu viverra eget, viverra interdum mauris.
    %p Curabitur consectetur felis eget mauris rhoncus nec condimentum leo malesuada. Vestibulum dictum ipsum nisi, ac molestie tellus. Nam tincidunt sollicitudin orci ac varius. Quisque ut nulla sapien. Nam venenatis blandit scelerisque. Nunc ut quam augue. Nullam imperdiet leo ac tellus molestie id hendrerit nisi venenatis. Suspendisse ut enim nec metus egestas porttitor. Phasellus condimentum ultrices turpis, vel aliquet urna interdum in. Mauris dignissim, arcu tristique ullamcorper sagittis, est orci congue nulla, eu egestas urna massa ut mi.
    %p Quisque sed sagittis libero. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed turpis mi, pharetra dictum accumsan vel, imperdiet eget sem. Duis non mattis magna. Pellentesque lobortis, risus a condimentum condimentum, neque massa fringilla quam, quis rhoncus arcu metus vel massa. In hac habitasse platea dictumst. In congue tincidunt imperdiet. Nunc at congue tortor. Suspendisse tincidunt, sem ac laoreet consectetur, justo nunc auctor ipsum, quis feugiat arcu sapien volutpat erat. Quisque id turpis magna. Praesent elementum, sapien vitae bibendum eleifend, felis eros hendrerit risus, vitae imperdiet lorem velit at lorem. Duis pulvinar accumsan ornare. Maecenas non ante a odio dictum tempor. Nulla facilisi.
            
          
!
            
              @import "compass/css3";

$bg-color:#ccc;

#search-box {
  display:inline-block;
  &:hover {
    input {
      width:164px;
      visibility:visible;
    }
  }
}

input {
  -webkit-transition: width 0.3s ease; 
  transition: width 0.3s ease; 
  
  height:32px;
  width:0;
  margin:0;
  visibility:hidden;
  border:solid 1px #000;
  background-color:transparent;
  
  &.stay {
    width:164px!important;
    visibility:visible!important;
  }
}

#icon {
  display:inline-block;
  position:relative;
  left:10px;
  width:16px;
  height:4px;
  background-color:#000;
  transform:rotate(45deg);
  -webkit-transform:rotate(45deg);
  border-bottom-right-radius:2px;
  border-top-right-radius:2px;
  
  &:hover {
    cursor:pointer;
  }
  
  &:before {
    content:"";
    position:absolute;
    top:-5px;
    left:-10px;
    display:block;
    width:16px;
    height:16px;
    background-color:#000;
    border-radius:50%;
  }
  
  &:after {
    content:"";
    position:absolute;
    left:-7px;
    top:3px - 5px;
    display:block;
    width:10px;
    height:10px;
    background-color:$bg-color;
    border-radius:50%;
  }
}

body {
  margin:0;
  padding:0;
}

.wrapper {
  width:960px;
  margin:auto;
  height:100%;
  padding:10px;
  background-color:$bg-color;
}

.screen-reader {
  position:absolute;
  left:-9999px;
  top:-9999px;
}
            
          
!
            
              init();

function init() {
  document.getElementById('search-box').addEventListener('mouseover', handleMouseOver);
  document.getElementById('term').addEventListener('keyup', handleTermKeyUp);
}

function handleMouseOver() {
  this.children[0].focus();
}

function handleTermKeyUp() {
  if (this.value !== '')
    this.className = 'stay';
  else
    this.className = '';
}
            
          
!
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.
Loading ..................

Console