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

              
                <link href='https://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Coustard:400,900' rel='stylesheet' type='text/css'>
  
<div class="menu">
<nav role='navigation'>
  <ul class='nav'>
    <li data-menu='Policy'>
      <a href="#">Policy</a>
    </li>
    <li data-menu='Arts'>
      <a href="#">Arts</a>
    </li>
    <li data-menu='World'>
      <a href="#">World</a>
    </li>
    <li data-menu='Sports'>
      <a href="#">Sports</a>
    </li>
    <li data-menu='Music'>
      <a href="#">Music</a>
    </li>
    <li data-menu='Identity'>
      <a href="#">Identity</a>
    </li>
    <li data-menu='News'>
      <a href="#">News</a>
    </li>
  </ul>
</nav>	

<div class="stories">
  <div class="most-viewed">Most viewed today in <span>policy</span>.</div>

  <div class="category policy">
    <figure>
      <img src="http://lorempixel.com/175/175" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est, odio.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/176" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis quo obcaecati sit praesentium cum dolores mollitia optio.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/177" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores suscipit sapiente, excepturi in omnis ipsum.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/177" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut praesentium beatae maxime nisi, nihil rerum necessitatibus.
        </figcaption>
    </figure>
  </div>
  <!-- /.policy -->

  <div class="category arts">
    <figure>
      <img src="http://lorempixel.com/175/178" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. In consectetur adipisci excepturi quod magni.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/179" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis fugiat laborum vero quam. Aperiam.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/180" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque enim temporibus voluptatum distinctio, ipsam pariatur!
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/181" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo temporibus voluptatum!
        </figcaption>
    </figure>
  </div>
  <!-- /.arts -->

  <div class="category world">
    <figure>
      <img src="http://lorempixel.com/175/182" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. In consectetur adipisci excepturi quod magni.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/183" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis fugiat laborum vero quam. Aperiam.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/184" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo modi et itaque enim temporibus voluptatum!
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/185" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo temporibus voluptatum!
        </figcaption>
    </figure>
  </div>
  <!-- /.world -->

  <div class="category sports">
    <figure>
      <img src="http://lorempixel.com/175/186" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. In consectetur adipisci excepturi quod magni.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/187" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis fugiat laborum vero quam. Aperiam.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/188" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo modi et itaque enim temporibus voluptatum!
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/189" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo temporibus voluptatum!
        </figcaption>
    </figure>
  </div>
  <!-- /.sports -->

  <div class="category music">
    <figure>
      <img src="http://lorempixel.com/175/190" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. In consectetur adipisci excepturi quod magni.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/191" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis fugiat laborum vero quam. Aperiam.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/192" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo modi et itaque enim temporibus voluptatum!
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/193" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo temporibus voluptatum!
        </figcaption>
    </figure>
  </div>
  <!-- /.music -->

  <div class="category identity">
    <figure>
      <img src="http://lorempixel.com/175/195" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. In consectetur adipisci excepturi quod magni.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/196" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis fugiat laborum vero quam. Aperiam.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/197" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo modi et itaque enim temporibus voluptatum!
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/198" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo temporibus voluptatum!
        </figcaption>
    </figure>
  </div>
  <!-- /.identity -->

  <div class="category news">
    <figure>
      <img src="http://lorempixel.com/175/199" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. In consectetur adipisci excepturi quod magni.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/200" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis fugiat laborum vero quam. Aperiam.
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/201" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo modi et itaque enim temporibus voluptatum!
        </figcaption>
    </figure>

    <figure>
      <img src="http://lorempixel.com/175/202" alt="" />
      <figcaption>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam eaque nemo, quasi ipsum illo temporibus voluptatum!
        </figcaption>
    </figure>
  </div>
  <!-- /.news -->
</div>
</div>
              
            
!

CSS

              
                //fonts
$sansSerif: 'Oswald', arial, sans-serif;
$serif: 'Coustard', arial, serif;

*, 
*::before, 
*::after {
  box-sizing: inherit;
}

html {
  box-sizing: border-box;
} 

html, body {
  height: 100%;
  width: 100%;
}

body {
  background: #f5f5f5;
}

.wrap {
	width: 1080px;
  margin: 0 auto;
}

.menu {
  padding: 1em;
  height: 100%;
  width: 100%;
  color: white;
}

.nav {
	width: 50%;
  float: left;
	li {
    font-size: 6em;
    font-family: $serif;
    font-weight: bold;
    text-transform: uppercase;
    display: block;
    line-height: 1.1; 
    text-align: right;
    &:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAFUlEQVQIW2NkQAKMUPZ/IM0I44DFABJxAQQMGKylAAAAAElFTkSuQmCC);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
    }
  }
  //change color on hover
	li:nth-child(1):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMIPbr1NT/orNnM4I5MAAASUUEBHf1/LwAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
	li:nth-child(2):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMIPaKprf/I+qEGcEcGAAASs0EBOX90nwAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
	li:nth-child(3):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMIHbGpGf/Z+RJMYI5MAAASfEEBPPbldMAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
	li:nth-child(4):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMIPbmWb7/fdM2M4I5MAAASNkEBEaKR7gAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
	li:nth-child(5):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMILZDq+n/A9WnGcEcGAAARlkEBMndkgEAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
	li:nth-child(6):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMIPbmWb7/fdM2M4I5MAAASNkEBEaKR7gAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
	li:nth-child(7):hover:before {
      content: attr(data-menu);
      position: absolute;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAGklEQVQIW2NkQAKMIPbr1NT/orNnM4I5MAAASUUEBHf1/LwAAAAASUVORK5CYII=);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      z-index: -1;
  }
  a {
    color: transparent;
  }
}

.stories { 
	width: 50%;
	float: left;
	padding: 1.5em 15% 0 3em;
	color: #222;
  font-family: $sansSerif;
  position: relative;
  .most-viewed {
    font-size: 1.3em;
    display: block;
    border-bottom: 1px solid black;
    text-transform: uppercase;
  }
}

.category {
  position: absolute;
  left: 0;
  top: 0;
  padding: 3em 50% 0 3em;
  opacity: 0;
  transition: .3s;
  figure {
    opacity: 0;
    margin: 0;
    display: block;
    clear: both;
    left: 15px;
    position: relative;
	  transition-duration: .3s;
  }
	figure img {
		float: left;
		margin: 0 1em 1em 0; 
		height: 150px;
		width: 150px;
	}
	figcaption {
    margin: 1em 0;
    font-weight: 300; 
    font-size: 1em;
	}
}

@for $i from 1 through 4 {
  .show figure:nth-child(#{$i}) { 
    transition-delay: $i * .12s;
  }
}

.category.show {
  opacity: 1;
	figure {
    opacity: 1;
    left: 0;
    transition-duration: .2s;
	} 
}

@media (max-width: 1250px) {
  html {
    font-size: 70%;
  }
  .category {
    padding-right: 25%;
    figure {
      font-size: 1.25em;
      img {
        height: 115px;
        width: 115px;
      }
    }
  }
}

@media (max-width: 900px) {
  .nav {
    width: 100%;
    padding: 0;
    li {
      text-align: center;
    }
  }
  .stories {
    display: none;
  }
}

@media (max-width: 700px) {
  html {
    font-size: 40%;
  }
  .nav {
    a {
      color: #222;
      line-height: 1.45;
      text-decoration: none;
    }
    li:before {
      content: '';
    }
    li:hover:before {
      content: '' !important; //being lazy here :(
    }
  }
}

              
            
!

JS

              
                //based on menu at http://mic.com. only works in chrome

(function($){

	var Menu = function(){
    this.$nav = $('.nav');
    this.$stories = $('.stories');
  }
  
  Menu.prototype.init = function(){
    this.initialState();
    this.ui();
  }
  
  Menu.prototype.initialState = function(){
    var i = 0,
        $img = $('.category').eq(0).find('img');
    
    $img.load(function(){
      i++;
      //wait for all images to load
      if (i === $img.length) {
	      $(this).parent().parent().addClass('show');
      }
    }); 
  }
  
  Menu.prototype.ui = function(){
    var self = this;

    //show recent articles on hover
    self.$nav.on('mouseenter', 'li', function(){
      var $this = $(this);		

      $('.category')
        .removeClass('show')
        .eq($this.index())
        .css('left', 0)
        .stop(true, true)
        .addClass('show');

      self.$stories
        .find('span')
        .text(
          $this.attr('data-menu')
        );
     });
  }
  
  //go go go!
  var menu = new Menu().init();
  
  }(jQuery))
              
            
!
999px

Console