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.

            
              <h1>Slowly resize screen to see the width transition</h1>
<div class="nav-container">
  <ul class="nav">
    <li class="active">
      <a href="#">
        <span class="icon-home"></span>
        <span class="text">home</span>
      </a>
    </li>
    <li>
      <a href="#">
        <span class="icon-user"></span>
        <span class="text">about</span>
      </a>
      </li>
    <li>
      <a href="#">
        <span class="icon-headphones"></span>
        <span class="text">Audio</span>
      </a>
      </li>
    <li>
      <a href="#">
        <span class="icon-picture"></span>
        <span class="text">Portfolio</span>    
      </a>
    </li>
    <li>
      <a href="#">
        <span class="icon-facetime-video"></span><span class="text">video</span>
      </a>
    </li>
  </ul>
</div>
            
          
!
            
              *{
  box-sizing: border-box;
}
body{
  height:100%;
  background-color: #444;
}
h1{
  font-size:1em;
  text-align:center;
  color: #eee;
  letter-spacing:1px;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}
.nav-container{
  width:300px;
  margin-top:10px;
  box-shadow: 0 2px 2px 2px black;
  transition: all 0.3s linear;
}
.nav{
  list-style-type:none;
  margin:0;
  padding:0;
}
li{
  height:50px; 
  position:relative;
  background: linear-gradient(#292929, #242424);
}
a {
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid black;
  text-decoration:none;
  display:block;
  height:100%;
  width:100%;
  line-height:50px;
  color:#bbb;
  text-transform: uppercase;
  font-weight: bold;
  padding-left:25%;
  border-left:5px solid transparent;
  letter-spacing:1px;
  transition: all 0.3s linear;
}
.active a{
  color: #B93632;
  border-left:5px solid #B93632;
  background-color: #1B1B1B;
  outline:0;
}
li:not(.active):hover a{
  color: #eee;
  border-left: 5px solid #FCFCFC;
  background-color: #1B1B1B;
}
span[class ^= "icon"]{
  position:absolute;
  left:20px;
  font-size: 1.5em;
  transition: all 0.3s linear;
}

@media only screen and (max-width : 860px){
  
  .text{
    display:none;
  }
  
  .nav-container , a{
    width: 70px;
    
  }
   
  a:hover{
    width:200px; 
    z-index:1;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid black;
    box-shadow: 0 0 1px 1px black;
  }
  
  a:hover  .text {
    display:block;
    padding-left:30%;
  }
}
@media only screen and (max-width : 480px){
  .nav-container, a{ width:50px;}
  span[class ^= "icon"]{ left:8px;}
}

            
          
!
            
              $('li').click(function(){
  
  $(this).addClass('active')
       .siblings()
       .removeClass('active');
    
});

/*

Inspired by Asif Aleem's work: http://www.freebiesgallery.com/responsive-website-navigation/

Feel free to fork it and make it better, AND use it however u want, the whole functionality could, of course, have been done with jQuery alone, but I thought I'd try to do it with CSS3, to make use of media query transitions, and of course, just to practice more.
You can use this when changing orientation on a tablet or smart phone for example.. and of course, use ur creative minds for any more uses u can come up with :)

Follow me on Twitter: https://twitter.com/SaraSoueidan

*/
            
          
!
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