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

              
                <nav class="w-screen px-4 lg:px-10 py-2 flex flex-col lg:flex-row lg:items-center fixed bg-blue-100 shadow-md">
  <!-- Our logo and button -->
  <section class="w-full lg:w-max flex justify-between">
    <!-- Logo -->
    <span class="font-black tracking-tight text-xl text-blue-600">
      CoolNavbar
    </span>

    <!-- Our open/close buttons -->
    <!-- Open menu -->
    <button class="lg:hidden" id="open-menu">
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" display="block" id="TextAlignJustified">
        <path d="M3 6h18M3 12h18M3 18h18" />
      </svg>
    </button>

    <!-- Close menu -->
    <button class="hidden" id="close-menu">
      <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" display="block" id="Cross">
        <path d="M20 20L4 4m16 0L4 20" />
      </svg>
    </button>
  </section>

  <!-- Our list of items -->
  <ul id='menu-items' class="hidden lg:flex w-full flex-col lg:flex-row lg:pl-6">
    <li class="py-2"><a class="text-lg font-medium lg:px-4 text-gray-600 hover:text-blue-500" href="/">Home</a></li>
    <li class="py-2"><a class="text-lg font-medium lg:px-4 text-gray-600 hover:text-blue-500" href="/">Nice Item</a></li>
    <li class="py-2"><a class="text-lg font-medium lg:px-4 text-gray-600 hover:text-blue-500" href="/">Another Cool item</a></li>
    <li class="py-2"><a class="text-lg font-medium lg:px-4 text-gray-600 hover:text-blue-500" href="/">The last one...</a></li>
  </ul>
</nav>
              
            
!

CSS

              
                
              
            
!

JS

              
                const openMenu = document.getElementById("open-menu");
const closeMenu = document.getElementById("close-menu");
const menuItems = document.getElementById("menu-items");

openMenu.addEventListener("click", (event) => {
  event.preventDefault();
  openMenu.classList.add("hidden");
  closeMenu.classList.remove("hidden");
  menuItems.classList.remove("hidden");
});

closeMenu.addEventListener("click", (event) => {
  event.preventDefault();
  openMenu.classList.remove("hidden");
  closeMenu.classList.add("hidden");
  menuItems.classList.add("hidden");
});

              
            
!
999px

Console