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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


Add 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 or require. We'll also process your JavaScript with Babel.

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


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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

              <p>Click/hover the links below to show/hide the corresponding section.<p>
<p>You will need to change the value of the if statement on line 3 to test the other half of the function.</p>

<!-- Main Links -->
<h3>MAIN LINKS</h3>
<div class="main">
  <div class="latest">
    <a href="">Latest</a>
  <div class="news">
    <a href="">News</a>
  <div class="insights">
    <a href="">Insights</a>
  <div class="skills">
    <a href="">Skills</a>

<!-- Associated Pages -->

<div class="subpages">

  <div class="latest drop_down">
    <p>Example Content</p>

  <div class="news drop_down">
    <p>Example Content</p>

  <div class="insights drop_down">
    <p>Example Content</p>

  <div class="skills drop_down">
    <p>Example Content</p>

              .main {
  border-bottom: 1px solid #DDDDDD;

.main > div {
  display: inline-block;
  margin-right: 10px;
  padding-bottom: 20px;

.subpages .drop_down {
  border-bottom: 1px solid #DDDDDD;
  display: none;
  padding: 10px 0;

.subpages .drop_down .item {
  margin-right: 10px;
  float: left;

.subpages .drop_down.visible {
  display: block;
              $(window).on('resize', function() {
  // Usually if screen width is less than 480px wide but for testing it's greater than 10px
  if ($(this).width() > 10) {

    $(".main > div a").click(function(e) {

      // Prevent default link behaviour
      // Once link is clicked do the following instead of default action

      // Add active link to element - Can I have the active class removed somehow too if it's clicked a second time?
      $('.main .item a').removeClass('active');

      // Set the class of the parent div as a varible - the additional class on .item
      var className = '.' + $(this).parent('div').attr('class');

      // Remove class from all .drop_down divs and then add .visible to the one that has the same class as the link you click
      $('.subpages .drop_down').removeClass('visible');

      // This is a refresh for Owl Carousel 2 - their default refresh event is broken so I have to use this, found it on a github issue post, but this may be the cause?. Default found here -
      if (document.createEvent) {
        window.dispatchEvent(new Event('resize'));
      } else {
    // Else restore click functionality
    $('.main .item a').unbind('click');
    // Hide all by removing visible class from all .drop_down divs
    $('.menu_contain .subpages .drop_down').removeClass('mobile_open');
    // Do same as above, but on hover instead
    $(".main > div").hover(function() {
      var className = '.' + $(this).attr('class');


// Run resize function above on page load

$(document).ready(function() {