css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <body id="body"> <!-- body will be the .nav-button target -->
<aside class="sidebar">
  <nav id="navigation" role="navigation">
    <a href="#">Salade</a>
    <a href="#">Tomate</a>
    <a href="#">Oignons</a>
    <a href="#">Choucroute</a>
    <a href="#">Picon bière</a>
 <!-- /aside -->

<div class="wrapper">
  <a href="#body" class="nav-button-open" aria-label="open navigation"></a>
  <a href="#" class="nav-button-close" aria-label="close navigation"></a>
  <header id="header">
    <h1>Push left CSS Nav</h1>

  <div class="main">
    <h2>partie "main"</h2>
    <p>Navigation "off Canvas" basée sur :</p>
      <li>CSS pour la décoration du lien-bouton (via linear-gradients)</li>
      <li>CSS pour l'évément du "touch" (via :target)</li>
      <li>CSS pour la transition</li>
    <p>Le principe général est celui-ci :</p>
      <li>Sur grand écran (mini 768), "sidebar" est simplement placé en haut de "wrapper".</li>
      <li>Sur petit écran (maxi 767), "sidebar" passe en position absolute, "wrapper" est décalé en translation par dessus "sidebar".</li>
    <p>Pré-requis :</p>
      <li>body doit avoir un id pour être ciblé par l'ancre</li>

  <footer id="footer">
    <p>Mon <b>footer</b>
<!-- /wrapper -->
              /* preventing from overflow */
body {
  overflow-x: hidden;

/* wrapper styles */
.wrapper {
  position: relative;
  min-height: 100vh;

/* small screens styles */
@media (max-width: 767px) {
  .sidebar {
    position: absolute;
    top: 0;
    width: 50vw;
    min-height: 100vh;
  .wrapper {
    transform: translateX(0) translateZ(0);
    transition: transform .2s;
    will-change: transform;

  /* Button deco */
  [class^="nav-button"] {
    display: block;
    z-index: 1;
    height: 3.5rem; width: 3.5rem;
    background-color: transparent;
    background-image: linear-gradient(to right, #333, #333),
      linear-gradient(to right, #333, #333),
      linear-gradient(to right, #333, #333);
    background-position: center top, center, center bottom;
    background-repeat: no-repeat;
    background-size: 3.5rem .9rem;
    padding: 0;
    outline: 0;
    border: 0;
    cursor: pointer;
  /* here's goes the push left effect */
  body:target .wrapper {
    transform: translateX(50vw);
  body:target .nav-button-open {
    display: none;
  body:target .nav-button-close {
    display: block;
} /* end of small screen media query */

/* Global deco */
* {
  box-sizing: border-box;
html {
  font-size: 62.5%;
body {
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 1.6em;
  font-family: arial, sans-serif;
a {
  color: #fff;
.wrapper {
  padding: 2rem;
  background-color: #eee;
  color: #333;
.sidebar {
  padding-top: 1em;
  background: #333;
  color: #ddd;
nav a {
  display: block;
  padding: .7em;
  margin-bottom: 2px;
  text-decoration: none;
  background: rgba(255,255,255, 0.1);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................