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 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.

            
              <div id="page_container">
  
	<div id="main_content">

		<div class="front face">
    		
    		<!-- ALL THE SITE CONTENT GOES HERE -->
    		
    		<header class="clearfix">
	
				<nav class="clearfix">
					<a id="menu-toggle" class="anchor-link" href="#mobile-nav">MENU</a>
					<ul>
			        	<li><a href="#">Home</a></li>
			        	<li><a href="#">About</a></li>
			        	<li><a href="#">Collection</a></li>
			        	<li><a href="#">Blog</a></li>
			        	<li><a href="#">Contact</a></li>
			        	<li><a href="#">Directions</a></li>
			        </ul>
				</nav>
			
				<h1>The Backside Menu Flip</h1>

			</header>
			
			
			<article class="clearfix">
				
				<p>The idea behind this responsive menu is that as we get to a certain width (less than 768px), the menu goes away and we are presented with a single "menu" button. Pretty standard stuff. <em>Then</em> when that button is clicked, the entire page flips around to reveal the navigation.</p>
				
				<p>The navigation takes up the entire "backside" of the page. This gives you lots of flexibility to style the menu to however you see fit!</p>
				
				<p>I also like the user's experience here. By watching the site flip they know that they are viewing a different panel. As opposed to putting your menu in the footer and using an anchor link (which could cause an abrupt jump) this methods lets the user see what's happening. It's a similar thought process behind the "off-canvas" page slide which facebook uses.</p>
				
				<p>Right now this is just in beta. While working with navigation in responsive design, I thought it might be fun to put the menu on the "backside" of the page content. This frees us up to do whatever the hell we want with the menu on the backside of the page! <del>It might not be quite semantic and probably doesn't yet* provide a fallback solution, but that shouldn't be too hard!</del> <span style="color:red;">***Update:</span> I added a fallback for devices without Javascript OR devices that don't support CSS transformations.  If a device doesn't have JS or support CSS transforms, then the menu simply appears in the footer and the menu link at the top anchors them to that position in the footer.</p>
				
				 
			
			</article>
			
			
			<footer>
			
				<p class="copyright"><a href="http://erickar.be">erick arbe</a></p>
				
			</footer>
  		
  		</div><!-- END .front -->
  		
  		<div class="back face center">
    		
    		<!-- BACK FACING CONTENT (NAV) HERE -->
    		
    		<header class="clearfix">
    			
    			<a id="return" class="anchor-link" href="#">RETURN</a>
    			
    		</header>
    		
    		<nav id="mobile-nav">
	
				<ul>
		        	<li><a href="#">Home</a></li>
		        	<li><a href="#">About</a></li>
		        	<li><a href="#">Collection</a></li>
		        	<li><a href="#">Blog</a></li>
		        	<li><a href="#">Contact</a></li>
		        	<li><a href="#">Directions</a></li>
		        </ul>
        
		    </nav>
    		
  		</div><!-- END .back -->
  		
	</div><!-- END #main_content -->

</div><!-- END #page_container -->
            
          
!
            
              * { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }

header, article { max-width: 87.500em; margin: 0 auto; }
header { margin-bottom: 2em; }
header > h1 { text-align: center;  }
article { padding: 5em; }

header nav { width:100%; border-bottom: 1px solid #ccc;  padding: .6em 0; }
header ul { list-style: none; padding: 0px; margin: 0px; font-weight: bold; text-align: center; }
header ul li { display: inline-block; text-align: left; }
header ul li a { display: block; padding: 5px 10px; text-decoration: none; color: #444; }
header ul li a:hover { background-color: #ccc; }

.anchor-link { display: none; font-weight: bold; padding: 0 1em; text-align: right; text-decoration: none; color: #8A2404; float: right; }
#mobile-nav { display:none; }

p.copyright { text-align: center; }

#mobile-nav ul { list-style: none; margin: 0px; padding: 0px; }
#mobile-nav ul li { list-style: none; text-align: center; }
#mobile-nav ul li a { display: block; padding: 20px 10px; border-bottom: 1px solid #ccc; text-decoration: none; }
#mobile-nav ul li a:hover { background-color: #ccc; color: #fff; }

@media (max-width:48.000em){
  
	article { padding: 1.5em; }
	header nav { padding: 0.6em 0; }
	header nav > ul { display: none; }
	.anchor-link, #mobile-nav { display: block; }
	
	.back header { padding: .8em 0; background-color: #444; }
	.back header .anchor-link { color: #fff; }

	#page_container {
	  position: relative;
	  margin: 0px auto;
	  width: 100%;
	  z-index: 1;
	  -webkit-perspective: 1000px;
	  -moz-perspective: 1000px;
	  -o-perspective: 1000px;
	  perspective: 1000px;
	}
	#main_content {
	  width: 100%;
	  height: 100%;
	  -webkit-transform-style: preserve-3d;
	  -webkit-transition: all 1.0s linear;
	  -moz-transform-style: preserve-3d;
	  -moz-transition: all 1.0s linear;
	  -o-transform-style: preserve-3d;
	  -o-transition: all 1.0s linear;
	  transform-style: preserve-3d;
	  transition: all 1.0s linear;
	}
	
	#page_container.active #main_content {
	  -webkit-transform: rotateY(180deg);
	  -moz-transform: rotateY(180deg);
	  -o-transform: rotateY(180deg);
	  transform: rotateY(180deg);
	
	  -webkit-box-shadow: -5px 5px 5px #aaa;
	  -moz-box-shadow: -5px 5px 5px #aaa;
	  box-shadow: -5px 5px 5px #aaa;
	}
	.face {
	  position: absolute;
	  width: 100%;
	  height: 100%;
	  -webkit-backface-visibility: hidden;
	  -moz-backface-visibility: hidden;
	  -o-backface-visibility: hidden;
	  backface-visibility: hidden;
	}
	.face.back {
	  display: block;
	  -webkit-transform: rotateY(180deg);
	  -webkit-box-sizing: border-box;
	  -moz-transform: rotateY(180deg);
	  -moz-box-sizing: border-box;
	  -o-transform: rotateY(180deg);
	  -o-box-sizing: border-box;
	  transform: rotateY(180deg);
	  color: white;
	  text-align: center;
	}

	.no-js #mobile-nav, 
	.no-csstransforms #mobile-nav { display: block; border-top: 1px solid #ccc; }
	.no-js .face,
	 .no-csstransforms .face{ position: relative; }
	.no-js .face.back { 
	  -webkit-transform: inherit;
	  -moz-transform: inherit;
	  -o-transform: inherit;
	  transform: inherit;
	 }
	 .no-js .back header,
	 .no-csstransforms .back header { display:none; }
	
}
            
          
!
            
              $(document).ready(function() {
  
	window.scrollTo(0, 1);
	
	$('.js #menu-toggle').click(function (e) {
		$('#page_container').addClass('active');
		e.preventDefault();
    });
    
    $('#return').click(function(e){
    	$('#page_container').removeClass('active');
    	e.preventDefault();
    });
    
});
            
          
!
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