Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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 class="relative min-h-screen md:flex">

  <!-- mobile menu bar -->
  <div class="bg-gray-800 text-gray-100 flex justify-between items-center md:hidden">
    <! -- logo -->

      <a href="#" class="block p-4 text-white font-bold"> ALEF </a>
      <! -- mobile menu button -->
        <button class="mobile-menu-button p-4 focus:outline-none focus:bg-gray-700">
          <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
          </svg>
        </button>
  </div>

  <!-- sidebar -->

  <div class="sidebar bg-gray-100 text-gray-900 w-64 px-2 space-y-6 py-4 absolute md:relative md:translate-x-0 inset-y-0 left-0 transform -translate-x-full transition duration-200 ease-in-out">

    <!-- logo -->
    <a href="#" class="text-gray-900 flex items-center px-4">
      <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z" />
      </svg>
      <span class="text-2xl font-bold px-2">ALEF</span>
    </a>
    <!-- nav -->
    <nav>
      <a href="" class="block py-2 px-4 rounded hover:bg-gray-200 transition duration-200">About</a>
      <a href="" class="block py-2 px-4 rounded hover:bg-gray-200 transition duration-200">Bags</a>
      <a href="" class="block py-2 px-4 rounded hover:bg-gray-200 transition duration-200">Accessories</a>
      <a href="" class="block py-2 px-4 rounded hover:bg-gray-200 transition duration-200">Materials</a>
      <a href="" class="block py-2 px-4 rounded hover:bg-gray-200 transition duration-200">Contact</a>

    </nav>

  </div>

  <!-- content -->
  <div class="flex-1 p-10 text-2xl font-bold bg-yellow-300">
    content goes here
  </div>

</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                // grab everything we need
const btn = document.querySelector(".mobile-menu-button");
const sidebar = document.querySelector(".sidebar");

// add our event listener for the click
btn.addEventListener("click", () => {
  sidebar.classList.toggle("-translate-x-full");
});

              
            
!
999px

Console