cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <nav>
  <ul>
    <li>
    <a href="#" data-caption="Home">Home</a>
  </li> 
  <li class="list-item--active">
  <a href="#" class="active" data-caption="About">About</a>
  </li> 
  <li>      
  <a href="#" data-caption="Images">Images</a>
  </li> 
  <li>      
  <a href="#" data-caption="Videos">Videos</a>
  </li> 
  <li>      
  <a href="#" data-caption="Contact">Contact</a>
  </li> 
  </ul>
</nav> 
            
          
!
            
              * { 
  margin:  0;
  padding:  0;
  border:  0;
  vertical-align:  baseline; 
  /* outline: 1px dotted salmon; */
}
a {
  text-decoration:  none;
}
nav {
  font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
  display:  block; 
  height: 40px;
  background-color: #E8E8E8;
  padding: 1px 0;
}
nav ul {
  list-style: inside none;
}
nav li {
  float: left; 
  height: 40px;
  width: 90px;
  overflow: hidden;
  text-align: center;
  text-transform: uppercase; 
  margin-right: 1px; /* keep 1px between elements */
  position: relative;
}
.list-item--active {
  overflow: visible; 
}
nav a { 
  width: 100%;
  font-size: 12px; 
  color: #333;
  /* position: absolute; */
  /* top: 0; left: 0; right: 0; */
  position: relative;
  display: block;
  line-height: 40px; /* Vertically center text by making line height equal to height */
  /* Transitions effects for all browsers */
  -webkit-transition: all 200ms ease-in; /* Old webkit version including chrome, safari, etc. */
  -moz-transition: all 200ms ease-in; /* Old Firefox version */
  -ms-transition: all 200ms ease-in; /* IE 10+ - IE < 10 will just apply the top position without any transition affect */
  -o-transition: all 200ms ease-in; /* Old opera support */
  transition: all 200ms ease-in; /* Normal declatration */
}
nav a:hover
/*, nav a.active */ { 
  top: -100%;
}
/* http://css-tricks.com/pointer-events-current-nav/ */
nav a.active {  
  top: 0;
  pointer-events: none;
  cursor: default;
  background-color: #6495ED;
  color: #fff;
}
nav a.active:after {
  content: "";
  width: 0; 
  height: 0;
  position: absolute;
  top: 40px;
  left: 33.33%;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 10px solid #6495ED;
  background-color: transparent;
}
/* Insteed of badly duplicating text content in a span, use :after pseudo class add a blue block after the element with all required attributes. see pseudo class :after and :before for more details */
nav a:after {
  content: attr(data-caption); /* Use the data-caption attribute for the text content */
  display: block; 
  position: absolute;
  top: 100%;
  width: 100%; 
  height: 40px;
  background-color: #6495ED;
  color: #fff;
}
            
          
!
            
              // demo to answer a question in the css-tricks forums: http://css-tricks.com/forums/discussion/24987/active-page-navigation-triangle-help-
// it's a fork of: http://jsfiddle.net/attilahajzer/6Sxak/10/
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console