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

              
                <h1>Responsive breadcrumbs 2014</h1>
<div class="header">Header</div>

<div id="section-title" class="section-title">Expertise</div>

<ol id="sitemap" class="breadcrumb nav">
  <li><a href="#?">Home</a></li>
  <li><a href="#?">About</a></li>
  <li class="active"><a href="#?">Expertise</a>

    <!-- getting into a breadcrumb trail -->
    <ol>
      <li class="active"><a href="#?">Capital Markets</a>

        <ol>
          <li><a href="#?">By the Numbers</a></li>
          <!-- no link on current page -->
          <li class="current">Structured Products</li>
          <li><a href="#?">History</a></li>
        </ol>

      </li>
      <li><a href="#?">Investments</a></li>
    </ol>

  </li><!-- .active -->
  <li><a href="#?">Our Work</a></li>
  <li><a href="#?">Contact</a></li>    
  
</ol><!-- .breadcrumb -->

<h1>Expertise</h1>
<p>Page content! This is an example of a responsive breadcrumb navigation that can also behave as a neat sitemap tool. UX idea by <a href="https://codepen.io/Zinderfine/">@Zinderfine</a>, blogged about <a href="https://arleym.com/codepen-responsive-breadcrumbs/" target="_blank">Here</a></p></p>

<p>This was made in 2014! Updated without floats or jQuery version at <a href="https://codepen.io/ArleyM/pen/RwrKbpM">this link</a>
              
            
!

CSS

              
                @import "compass/css3";

body {
  padding:2em;
}
.header {
  background:#eee;
  margin-bottom:1em;
  padding:1em 0;
  font-size:3em;
  color:#bbb;
  text-align:center;
  margin-bottom:0;
}
ul, ol {
  padding:0;
}
// Classic: https://csswizardry.com/2011/09/the-nav-abstraction/
.nav{
    list-style:none;
    margin-left:0;
}
    .nav > li,
        .nav > li > a{
            display:inline-block;
           *display:inline;
            zoom:1;
    }



// The stuff for the ol' breadcrumbs
.breadcrumb {
  
  ol, li, a {
    display:block;
    float:left;
  }
  
  &:after {
    content:"";
    display:block;
    clear:both;
  }
  
  li {
    display:inline-block;
  }
  
  a, 
  .current {
    padding:.5em;
  }
  a {
    text-decoration:none;
  }
  
}









// Desktop first! 
.section-title {
  display:none;
}
.breadcrumb a:after {
  content: " »";
}
// Don't show the whole sitemap, just the active trail
.breadcrumb > li {
  display:none;
  
  &:first-child, // Home button exception
  &.active, 
  &.current {
    display:inline-block;
  }
    
    li { // active section siblings
      display:none;
      
      &.active,
      &.current {
        display:inline-block;
      }
    } // li 
} // sitemap > li 
@media (min-width:48em) { // 768px
  .breadcrumb {
    display:block !important;
    // We have to use !important to overwrite the JS state from slideToggle. Technicaly responsive isn't about playing your browser like an accordion, but people do. For them I use this! 
  }
}








// Mobile! 
@media (max-width:47.938em) { // 767px
  .section-title {
    display:block;
    padding:1em;
    background:#eee;
    cursor:pointer;
    margin-top:1em;
    
    &:hover {
      background:#e4e4e4;
    }
    
    &:before {
      content:"▾ ";
    }
    &.open:before {
      content: "▴ ";
    }
  } // .section-title

  .breadcrumb {
    padding:1em;
    margin:0;
    background:#fcfcfc;
    border:1px solid #eee;
    border-top:0;

    // Uncomment this to make the ol' dropdown go on top of the content. 
    //position:absolute;
    
    display:none;
    
    ol, li, a {
      float:none;
    }
  
    li {
      display:block;
      float:none;
    }
    a:after {
      content: "";
    } // a

 
     > li {  
      &:first-child,
      &.active, 
      &.current {
        display:block;
      }
      //&.current:before {
        //content:"▸ ";        
      //}
    
      li { 
        padding-left:1em;
      }
    
    } // > li 
  }// .breadcrumb

}







              
            
!

JS

              
                $('#section-title').on( "click", function() {
  $('#sitemap').slideToggle();
  $(this).toggleClass('open');
});
              
            
!
999px

Console