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

              
                <div id="container">
<header>
	<hgroup>
		<h1><a href="#">CSS3 Ribbon Menu</a></h1>
		<h2><a href="#"> 3D Buttons Using CSS3 &amp; Minimal jQuery</a></h2>
	</hgroup>
	
</header>
	<div id="menu">
	<nav>
	
	<ul>
	<span class="navbefore"></span>
   <li class="menu-item"><a href="#">About</a></li>
	<li class="menu-item"><a href="#">Facebook</a></li>
	<li class="menu-item"><a href="#">Twitter</a></li>
	<li class="menu-item"><a href="#">Portfolio</a></li>
	<li class="menu-item"><a href="#">Contact</a></li>
	<li class="menu-item"><a href="#">Home</a></li>
	<span class="navafter"></span>
	</ul>
	
	</nav>
   
	</div>
  
  
</div>

              
            
!

CSS

              
                /* 
Scroll down to see NAV CSS.

CSS3 Ribbon Menu 
http://stephenbelovarich.com
v1.0b1 | 201207
NOTE:WORK IN PROGRESS
USE WITH CAUTION, ADAPT TO YOUR LAYOUT


CSS3 Transforms! The buttons are just begging to be animated.

CSS3 Gradients! Hover over a button to see what I mean.

Depth while hovering is created using pseudo elements, transform and gradients.

When the nav is directed to content on a single page layout on iPad the default behavior keeps touched buttons pressed down. You could make an active pseudo class to keep the active button pressed when the user is viewing content.

Lots of pseudo elements! Whoo hoo! Which means older versions of IE can't handle it. But then again, it says CSS3 Ribbon Menu

Eric Meyer's RESET used, just b/c its always in my CSS so included it here to make sure everything works. 

Well commented so you can learn how it was made.

*/

/*------------------------------------*\
  RESET
\*------------------------------------*/
/* https://meyerweb.com/eric/tools/css/reset/
   v2.0b1 | 201101
   NOTE:WORK IN PROGRESS
   USE WITH CAUTION AND TEST WITH ABANDON */

html,body,div,span,applet,object,iframe,
h1,h2,h3,h4,h5,h6,p,blockquote,pre,
a,abbr,acronym,address,big,cite,code,
del,dfn,em,img,ins,kbd,q,s,samp,
small,strike,strong,sub,sup,tt,var,
b,u,i,center,
dl,dt,dd,ol,ul,li,
fieldset,form,label,legend,
table,caption,tbody,tfoot,thead,tr,th,td,
article,aside,canvas,details,figcaption,figure,
footer,header,hgroup,menu,nav,section,summary,
time,mark,audio,video{
  margin:0;
  padding:0;
  border:0;
  outline:0;
  font-size:100%;
  font:inherit;
  vertical-align:baseline;
}
/* HTML5 display-role reset for older browsers */
div,article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section{
  display:block;
}
body{
  line-height:1;
}
ol,ul{
  list-style:none;
}
blockquote,q{
  quotes:none;
}
blockquote:before,blockquote:after,
q:before,q:after{
  content:'';
  content:none;
}
/* remember to define visible focus styles!
:focus{
  outline:?????;
} */

/* remember to highlight inserts somehow! */
ins{
  text-decoration:none;
}
del{
  text-decoration:line-through;
}

table{
  border-collapse:collapse;
  border-spacing:0;
}

/*------------------------------------*\
  MAIN
\*------------------------------------*/
/* GO! */

body { 
 font: 14px "Helvetica", Helvetica, Arial, sans-serif;
 color: #000;
}

a:link, a:visited { 
	color: #222;
	text-decoration: none;
}
a:hover { 
	color: #666;
	text-decoration: none;
}

h1, h2, h3, h4, h5 {
	font-size: 2.2em;
}

#container {
	width:100%;
	height:auto;
  padding-bottom:320px;
	background: #f9f9f9; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPHJhZGlhbEdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzUlIj4KICAgIDxzdG9wIG9mZnNldD0iMjYlIiBzdG9wLWNvbG9yPSIjZjlmOWY5IiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2JmYmZiZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9yYWRpYWxHcmFkaWVudD4KICA8cmVjdCB4PSItNTAiIHk9Ii01MCIgd2lkdGg9IjEwMSIgaGVpZ2h0PSIxMDEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+Cjwvc3ZnPg==);
background: -moz-radial-gradient(center, ellipse cover,  #f9f9f9 26%, #bfbfbf 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(26%,#f9f9f9), color-stop(100%,#bfbfbf)); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover,  #f9f9f9 26%,#bfbfbf 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover,  #f9f9f9 26%,#bfbfbf 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover,  #f9f9f9 26%,#bfbfbf 100%); /* IE10+ */
background: radial-gradient(center, ellipse cover,  #f9f9f9 26%,#bfbfbf 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9f9f9', endColorstr='#bfbfbf',GradientType=1 ); /* IE6-8 fallback on horizontal gradient */

}


header {

	width: 100%;
	height: 10%;
	clear:both;
}

header hgroup {
	width: 75.2%;
	margin: 0 auto;	
	text-align: center;
	padding-top: 3%;
	padding-bottom: 3%;
}

hgroup h1, hgroup h2 {
	
	
}
hgroup h1 {
	
	font-size: 3em;
}
hgroup h2 {
	font-size: 2em;
}

header a:link, header a:visited {
	
}

/* NAV */

#menu {
	clear: both;
	display: block;
	position:relative;
	width: 1000px; /* fixed width allows for empty area in ribbon to be correctly sized */
	height:56px;
	margin: 0 auto; /* for fluid layout margin on either side */
	z-index:1;
	background: transparent;

}

/* following after and before is for the nav container #menu to give it the cut end look */

#menu:after, #menu:before {
    margin-top:0.5em;
    content: "";
    border:1.8em solid rgb(191,3,0); /* Old browsers */
    float:left;
    position:relative;
    margin-top:14px;
    z-index:0;
}

#menu:after {
	left:-8px;
    border-right-color:transparent;
}

#menu:before {
	left:8px;
   border-left-color:transparent;
}


/* actual navigation */

nav {
	width: 900px;
	height:56px;
	position:relative;
	 float:left;
	top:0;
	left:0;
	-webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 4px 6px;
	-moz-box-shadow: rgba(0, 0, 0, 0.4) 0px 4px 6px;
	box-shadow: rgba(0, 0, 0, 0.4) 0px 4px 6px;
	z-index:1;
}

nav ul {
	font-size: 16px;
	display:block;
	list-style: none;
	width:auto;
	margin: 0;
	padding-left: 0;
	overflow-y: visible;

}

/* So that the hover effect can retain transparency, the enitre nav cannot have a background. 
these classes style spans on either side left & right of the ul list to keep the ribbon intact */

.navbefore {

position:relative;
display:block;
width: 48px !important; /* must equal nav li:first-child margin-left */
height: 56px;
background: #BF0300; 
z-index:1;
 float:left;
}

.navafter {

position: relative; 
display:block;
width: 280px; /* must compensate for width of ul element, this width is changed via jQuery to compensate for hover */
height: 56px;

/*margin-left:548px;*/
background: #BF0300; 
z-index:1;
 float:right;
	
}

/* since the #menu container uses before and after to style the ends of the ribbon, 
i decided to make the folds on either side of the nav using :before and :after 
you could do this by styling the content, but thought this approach to be easier */


nav ul .navbefore:before, nav ul .navafter:after
    {
        content: '';
        position: absolute;
        border-style: solid;
        border-color: transparent;
        bottom: -8px;
    }

   nav ul .navbefore:before
    {
        border-width: 0 9px 9px 0;
        border-right-color: #5E0100;
        left: 0px;
       
    }

   nav ul .navafter:after    {
        border-width: 0 0 8px 8px;
        border-left-color: #5E0100;
        right: 0px;
    }
    
    
/* finally, we style a list element */

nav li {
	float: left;
	position: relative;
	z-index:1;
	-moz-transform: translate(0px, 0px);
	-webkit-transform: translate(0px, 0px);
    -o-transform: translate(0px, 0px);
    -ms-transform:  translate(0px, 0px);
    transform: translate(0px, 0px);
  

}



nav li:first-child {
	 margin-left:48px !important; /* this value should equal the width of .navbefore */
}



nav li a:link, nav li a:visited {
	color: #fff;
	display: block;
	line-height: 3.5em;
	padding: 0 1.2125em;
	text-decoration: none;
	font-weight:bolder;
	background: #BF0300;
 

}

/* transforms the li element on hover, could be animated instead */

nav li:hover {
	-moz-transform: translate(18px, -8px);
		-webkit-transform: translate(18px, -8px);
        -o-transform: translate(18px, -8px);
        -ms-transform:  translate(18px, -8px);
        transform: translate(18px, -8px);
	padding-top:18px !important; /* Fixes hover glitch when user moves mouse just above the pressed down li element */
}

/* changes the background color of the link inside the list element */


nav li:hover a:link {
	color: #fff;
	
	background: rgb(155,0,0); /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzliMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2JmMDMwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNhMzAwMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(left,  rgba(155,0,0,1) 0%, rgba(191,3,0,1) 50%, rgba(163,0,0,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(155,0,0,1)), color-stop(50%,rgba(191,3,0,1)), color-stop(100%,rgba(163,0,0,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left,  rgba(155,0,0,1) 0%,rgba(191,3,0,1) 50%,rgba(163,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left,  rgba(155,0,0,1) 0%,rgba(191,3,0,1) 50%,rgba(163,0,0,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left,  rgba(155,0,0,1) 0%,rgba(191,3,0,1) 50%,rgba(163,0,0,1) 100%); /* IE10+ */
background: linear-gradient(left,  rgba(155,0,0,1) 0%,rgba(191,3,0,1) 50%,rgba(163,0,0,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9b0000', endColorstr='#a30000',GradientType=1 ); /* IE6-8 */
}


/* gices the list element a skewed depth pseudo element to the left (before) , fold to the right (after) */

    
     nav ul li:before, nav ul li:after
    {
        content: '';
        position: absolute;
        border-style: solid;
        border-color: transparent;
        bottom: 0px;

  
    }
    
     nav ul li:before {
	    display:none;
	    	-moz-transform: translate(0px,0px) skew(0deg,0deg);
		-webkit-transform: translate(0px,0px) skew(0deg,0deg);
        -o-transform: translate(0px,0px) skew(0deg,0deg);
        -ms-transform: translate(0px,0px) skew(0deg,0deg);
        transform: translate(0px,0px) skew(0deg,0deg);
				
    }

     nav ul li:hover:before  {
       display:block;
       width:16px;
       height:50px;
       border-left: 1px solid #A50200 ;
       border-right: 1px solid #5E0100 ;
      	-moz-transform: translate(-18px,-5px) skew(0deg,28deg);
		-webkit-transform: translate(-18px,-5px) skew(0deg,28deg);
        -o-transform: translate(-18px,-5px) skew(0deg,28deg);
        -ms-transform: translate(-18px,-5px) skew(0deg,28deg);
        transform: translate(-18px,-5px) skew(0deg,28deg);
		background: rgb(191,3,0); /* Old browsers */
		/* IE9 SVG, needs conditional override of 'filter' to 'none' */
		background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iI2JmMDMwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQwJSIgc3RvcC1jb2xvcj0iI2EzMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM4NDA0MDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
		background: -moz-linear-gradient(left,  rgba(191,3,0,1) 1%, rgba(163,0,0,1) 40%, rgba(132,4,0,1) 100%); /* FF3.6+ */
		background: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(191,3,0,1)), color-stop(40%,rgba(163,0,0,1)), color-stop(100%,rgba(132,4,0,1))); /* Chrome,Safari4+ */
		background: -webkit-linear-gradient(left,  rgba(191,3,0,1) 1%,rgba(163,0,0,1) 40%,rgba(132,4,0,1) 100%); /* Chrome10+,Safari5.1+ */
		background: -o-linear-gradient(left,  rgba(191,3,0,1) 1%,rgba(163,0,0,1) 40%,rgba(132,4,0,1) 100%); /* Opera 11.10+ */
		background: -ms-linear-gradient(left,  rgba(191,3,0,1) 1%,rgba(163,0,0,1) 40%,rgba(132,4,0,1) 100%); /* IE10+ */
		background: linear-gradient(left,  rgba(191,3,0,1) 1%,rgba(163,0,0,1) 40%,rgba(132,4,0,1) 100%); /* W3C */
		filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bf0300', endColorstr='#840400',GradientType=1 ); /* IE6-8 */
		  
    }
    
 

    nav ul li:hover:after  {
        border-width: 0 0 10px 10px;
        border-left-color: #5E0100;
        right: -10px;
       
    }
    
    /* moves the next list element over 18px, why 18px? well thats the width of nav ul li:hover:before (16px + 2px border) */

nav li:hover + li  {
	
	-moz-transform: translate(18px, 0px);
		-webkit-transform: translate(18px, 0px);
        -o-transform: translate(18px, 0px);
        -ms-transform:  translate(18px, 0px);
        transform: translate(18px, 0px);
	
}
 

#credits {
  clear:both;
  font-size: 0.5em;
  width: 100%;
  text-align: center;
  padding-top: 36px;
}

              
            
!

JS

              
                $(document).ready(function () {

$('nav ul span.navafter').css('width', '280px');
$("nav ul li").eq(5).children('a:link').hover(function () {
              $('nav ul span.navafter').css('width', '262px');
            }, function () {
               $('nav ul span.navafter').css('width', '280px');
  });
  
  
});

  

/* 

Changes the width of .navafter (the ribbon after the nav buttons) when the last-child li is pressed. I chose to use eq method instead o flast-child b/c it's a more reliable selector.

If this wasn't corrected, the nav menu would overflow. Change the width accordingly when you add and subtract buttons. This also can be down programmatically, but loads slow. 

Currently bugs out if you hover over the :before skewed depth of the last-child li element. Not a big deal, but kinda annoying.

The jQuery is kept miminal, although I have developed another version of this with slick jQuery Transit the load times are significantly less with this implementation. Doesn't seem to work in this editor but it does in my WebKit IDE.


*/

              
            
!
999px

Console