cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <body>
  <nav class="main-navigation">
    <ul class="league-list">
      <li class="league">
        <button class="list-toggle js-list-toggle">American League</button>
        <ul class="division-list" aria-expanded="false">
          <li class="division">
            <button class="list-toggle js-list-toggle">East</button>
            <ul class="team-list" aria-expanded="false">
              <li class="team">
                <a href="orioles.html">Baltimore Orioles</a>
              </li>
              <li class="team">
                <a href="redsox.html">Boston Red Sox</a>
              </li>
              <li class="team">
                <a href="yankees.html">New York Yankees</a>
              </li>
              <li class="team">
                <a href="rays.html">Tampa Bay Rays</a>
              </li>
              <li class="team">
                <a href="bluejays.html">Toronto Blue Jays</a>
              </li>
            </ul>
          </li>
          <li class="division">
            <button class="list-toggle js-list-toggle">Central</button>
            <ul class="team-list" aria-expanded="false">
              <li class="team">
                <a href="whitesox.html">Chicago White Sox</a>
              </li>
              <li class="team">
                <a href="indians.html">Cleveland Indians</a>
              </li>
              <li class="team">
                <a href="tigers.html">Detroit Tigers</a>
              </li>
              <li class="team">
                <a href="royals.html">Kansas City Royals</a>
              </li>
              <li class="team">
                <a href="twins.html">Minnesota Twins</a>
              </li>
            </ul>
          </li>
          <li class="division">
            <button class="list-toggle js-list-toggle">West</button>
            <ul class="team-list" aria-expanded="false">
              <li class="team">
                <a href="astros.html">Houston Astros</a>
              </li>
              <li class="team">
                <a href="angels.html">Los Angeles Angels</a>
              </li>
              <li class="team">
                <a href="as.html">Oakland A&rsquo;s</a>
              </li>
              <li class="team">
                <a href="mariners.html">Seattle Mariners</a>
              </li>
              <li class="team">
                <a href="rangers.html">Texas Rangers</a>
              </li>
            </ul>
          </li>
        </ul>
      </li>
      <li class="league">
        <button class="list-toggle js-list-toggle">National League</button>
        <ul class="division-list" aria-expanded="false">
          <li class="division">
            <button class="list-toggle js-list-toggle">East</button>
            <ul class="team-list" aria-expanded="false">
              <li class="team">
                <a href="braves.html">Atlanta Braves</a>
              </li>
              <li class="team">
                <a href="marlins.html">Miami Marlins</a>
              </li>
              <li class="team">
                <a href="mets.html">New York Mets</a>
              </li>
              <li class="team">
                <a href="phillies.html">Philadelphia Phillies</a>
              </li>
              <li class="team">
                <a href="nationals.html">Washington Nationals</a>
              </li>
            </ul>
          </li>
          <li class="division">
            <button class="list-toggle js-list-toggle">Central</button>
            <ul class="team-list" aria-expanded="false">
              <li class="team">
                <a href="cubs.html">Chicago Cubs</a>
              </li>
              <li class="team">
                <a href="reds.html">Cincinnati Reds</a>
              </li>
              <li class="team">
                <a href="brewers.html">Milwaukee Brewers</a>
              </li>
              <li class="team">
                <a href="pirates.html">Pittsburgh Pirates</a>
              </li>
              <li class="team">
                <a href="cardinals.html">St Louis Cardinals</a>
              </li>
            </ul>
          </li>
          <li class="division">
            <button class="list-toggle js-list-toggle">West</button>
            <ul class="team-list" aria-expanded="false">
              <li class="team">
                <a href="diamondbacks.html">Arizona Diamondbacks</a>
              </li>
              <li class="team">
                <a href="rockies.html">Colorado Rockies</a>
              </li>
              <li class="team">
                <a href="dodgers.html">Los Angeles Dodgers</a>
              </li>
              <li class="team">
                <a href="padres.html">San Diego Padres</a>
              </li>
              <li class="team">
                <a href="giants.html">San Francisco Giants</a>
              </li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
  </nav>

</body>

            
          
!
            
              // Variables

$text-color: #444;
$border-color: rgba(black, 0.1);

// Mixins

@mixin accordion(
  // Defaults
  $duration: 0.5s,
  $easing: ease
  ) {
  position: relative; // ...so we can absolutely position the pseudoelement
  &:after {
    content: '\25bc'; // ‘Black Down-Pointing Triangle’
    position: absolute;
    right: 0.5em;
    transition: transform $duration $easing;
  }
  & + ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height $duration $easing;
  }
  &.list-open {
    &:after {
      transform: rotateX(180deg);
    }
    & + ul {
      max-height: 100vh;
    }
  }
}

// SCSS

// Quickie global reset
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  color: $text-color;
  font-family: 'Helvetica', 'Arial', sans-serif;
}

ul {
  list-style: none;
  width: 15em;
}

button,
a {
  display: block;
  padding: 0.5em;
  border-bottom: 1px solid $border-color;
}

// Make a button look like a link
button {
  background: none;
  border: 0;
  border-bottom: 1px solid $border-color;
  color: $text-color;
  font-family: inherit;
  font-size: 1em;
  text-align: left;
  width: 100%;
  &:hover {
    cursor: pointer;
  }
}

a {
  color: $text-color;
  text-decoration: none;
}

.list-toggle {
  @include accordion;
}

.main-navigation {
  margin: 2em;
}

.league-list {
  background-color: #ccc;
}

.division-list {
  background-color: #ddd;
}

.team-list {
  background-color: #eee;
}

            
          
!
            
              $(function() {

  $('.js-list-toggle').click(function() {
    if ($(this).hasClass('list-open')) {
      $(this).removeClass('list-open')
        .next().attr('aria-expanded', 'false');
    } else {
      $(this).addClass('list-open')
        .next().attr('aria-expanded', 'true');
    }
  });

});

            
          
!
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