Pen Settings



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


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


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.


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.


                <button type="button" id="hamburger-menu" class="open-nav-btn" aria-haspopup="dialog"><span aria-hidden="true">&#9776;</span>Menu</button>
  <div role="dialog" aria-label="main menu" aria-modal="true" id="slide-nav" class="slide-content">
     <h2 id="title" class="sr-only">Main Menu</h2>
    <button type="button" id="close" class="close-btn" aria-label="close main menu">&times;</button>
        <ul id="link-list">
          <li><a href="#">Services</a></li>
          <li><a href="#">Programs</a>
          <li><a href="#">Blog</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>

  <h1>Dialog Hamburger Menu</h1>

    <p>Based on <a href="">Slide-Out Navigation by Alicia Evans</a></p>
        <li>Added the word "Menu" under the hamburger symbol.</li>
        <li>Added aria-haspopup="dialog" to the trigger button.</li>
        <li>Removed aria-expanded from the trigger button.</li>
        <li>Added role="dialog", aria-labelledby="title" (attached to visually hidden title) and aria-modal="true" to the menu container.</li>
        <li>Added the nav element around the menu list.</li>

    <p>This pattern is intended to be used on a responsive view only. It displays on desktop view only to facilitate the sharing of the demo.</p>


                body {
  font-family: "Arial", sans-serif;
  background-color: #F5F5F5;
} {
  clip: rect(0 0 0 0); 
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap; 
  width: 1px;
} {
  font-size: 1rem;
  border: 1px solid black;
  background-color: transparent;
  margin: 10px;
button span{
    font-size: 2rem;

.slide-content {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: black;
  overflow-x: hidden;
  transition: width 0.5s;
  padding-top: 60px;
  visibility: hidden;

.slide-content a {
  padding: 8px 8px 8px 32px;
  text-decoration: none;
  font-size: 25px;
  color: #F5F5F5;
  display: block;

.slide-content a:focus,
.slide-content button:focus {
  outline: 2px solid orange;

#link-list {
main a:focus,
.open-nav-btn:focus {
  outline: 2px solid blue;
  outline-offset: 5px;

.close-btn {
  font-size: 25px;
  color: #F5F5F5;
  background-color: transparent;
  border: none;

.slide-content a:hover,
.slide-content a:focus {
  text-decoration: underline;

.slide-content .close-btn {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 36px;
  margin-left: 50px;

.visible {
  visibility: visible;

.active {
  width: 250px;


                document.documentElement.setAttribute("lang", "en");

// jQuery element variables
var $hamburgerMenuBtn,

// focus management variables
var $focusableInNav,

$(document).ready(function() {
  $hamburgerMenuBtn = $("#hamburger-menu"),
    $slideNav = $("#slide-nav"),
    $closeBtn = $("#close"),
    $main = $("main"),
    $focusableInNav = $('#slide-nav button, #slide-nav [href], #slide-nav input, #slide-nav select, #slide-nav textarea, #slide-nav [tabindex]:not([tabindex="-1"])');
  if ($focusableInNav.length) {
    $firstFocusableElement = $focusableInNav.first();
    $lastFocusableElement = $focusableInNav.last();

function addEventListeners() {
  $slideNav.on("keyup", closeNav);
  $firstFocusableElement.on("keydown", moveFocusToBottom);
  $lastFocusableElement.on("keydown", moveFocusToTop);

function openNav() {
  $slideNav.addClass("visible active");
  setTimeout(function() {
  }, 1);
  $main.attr("aria-hidden", "true");
  $hamburgerMenuBtn.attr("aria-hidden", "true");

function closeNav(e) {
  if (e.type === "keyup" && e.key !== "Escape") {

  setTimeout(function() {
  }, 1);
  setTimeout(function() {
  }, 501);

function moveFocusToTop(e) {
  if (e.key === "Tab" && !e.shiftKey) {

function moveFocusToBottom(e) {
  if (e.key === "Tab" && e.shiftKey) {