Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

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

              
                <nav class="top-bar" data-topbar="">
    <ul class="title-area">
      <!-- Title Area -->
      <li class="name">
        <h1>
          <a href="#">
            Top Bar Title
          </a>
        </h1>
      </li>
      <li class="toggle-topbar menu-icon"><a href="#"><span>menu</span></a></li>
    </ul>

    
  <section class="top-bar-section">
      <!-- Right Nav Section -->
      <ul class="right">
        <li class="divider"></li>
        <li class="has-dropdown">
          <a href="#">Main Item 1</a>
          <ul class="dropdown">
            <li><label>Section Name</label></li>
            <li class="has-dropdown">
              <a href="#" class="">Has Dropdown, Level 1</a>
              <ul class="dropdown">
                <li><a href="#">Dropdown Options</a></li>
                <li><a href="#">Dropdown Options</a></li>
                <li><a href="#">Level 2</a></li>
                <li><a href="#">Subdropdown Option</a></li>
                <li><a href="#">Subdropdown Option</a></li>
                <li><a href="#">Subdropdown Option</a></li>
              </ul>
            </li>
            <li><a href="#">Dropdown Option</a></li>
            <li><a href="#">Dropdown Option</a></li>
            <li class="divider"></li>
            <li><label>Section Name</label></li>
            <li><a href="#">Dropdown Option</a></li>
            <li><a href="#">Dropdown Option</a></li>
            <li><a href="#">Dropdown Option</a></li>
            <li class="divider"></li>
            <li><a href="#">See all →</a></li>
          </ul>
        </li>
        <li class="divider"></li>
        <li class="has-dropdown">
          <a href="#">Main Item 2</a>
          <ul class="dropdown">
            <li><a href="#">Dropdown Option</a></li>
            <li><a href="#">Dropdown Option</a></li>
            <li><a href="#">Dropdown Option</a></li>
            <li class="divider"></li>
            <li><a href="#">See all →</a></li>
          </ul>
        </li>
      </ul>
    </section></nav>
<section class="description">
  <p>This is a top bar example using Foundation 5.4.5. The HTML was borrowed from the <a href="https://foundation.zurb.com/docs/components/kitchen_sink.html" target="_blank">Kitchen Sink</a> and the JS-generated elements were stripped.
</p>
  <section>
    <h4 class="description-header">Issues</h4>
    <ol>
      <li>On a wide touch device where the menu is not collapsed (iPad, e.g.): touching off an open menu does not close the menu here; however, it does in the Kitchen Sink. See <a href="https://foundation.zurb.com/docs/components/kitchen_sink.html" target="_blank">the current example</a> or <a href="https://web.archive.org/web/20140925153143/https://foundation.zurb.com/docs/components/kitchen_sink.html" target="_blank">the example from 5.4.5</a> (on September 25, 2014 via <a href="https://archive.org/web/" target="_blank">The Wayback Machine</a>).
      Also, if <kbd>data-options="is_hover:false"</kbd> is added a menu can be closed by touching the "Main Item #" link again; however, they still do not close when touching off the menu. <span class="label"><strong>Note:</strong> The above holds true if the version is changed from 5.4.5 to 5.5.2. But only in Code Pen! Both Kitchen Sinks still work.</span>
      </li>
      <li>On a wide non-touch device (desktop) the hover works fine, but clicks interfere. If you click "Main Item 1" then hover "Main Item 2" both menus remain open and overlap. This behavior can be prevented by removing <kbd>href</kbd> from both links; however, this is contrary to the documentation and may violate standards (?).</li>

    </ol>
  </section>
 <section>
    <h4 class="description-header">Observations</h4>
    <ol>
      <li>The HTML of the current Kitchen Sink example (5.5.2) matches that of 5.4.5.</li>
      <li>Everything works well at small widths (when the menu is collapsed and the submenus slide).</li>
      <li>The hover/touch behavior is on <kbd>.has-dropdown</kbd> not <kbd>a</kbd>. It even works if the <kbd>a</kbd> is changed to a <kbd>span</kbd>, for example.</li>
    </ol>
  </section>
   <section>
    <h4 class="description-header">Issues from Elsewhere</h4>
    <p>In reality, I'm using foundation-rails 5.4.5 and it exhibits additional behavior not shown here. On a wide touch device where the menu is not collapsed (iPad, e.g.) do the following:
      <ol>
        <li>Touch "Main Item 1" (menu opens)</li>
        <li>Touch the background (no change)</li>
        <li>Touch "Main Item 1" &mdash; but only once! (no change)</li>
        <li>Touch the backgorund (the menu closes!)</li>
    </ol>
  </section>
</section>
              
            
!

CSS

              
                .description {
  padding: 1em;
}
              
            
!

JS

              
                $(document).foundation();
              
            
!
999px

Console