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


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-label="open navigation" aria-controls="link-list" aria-expanded="false">&#9776;</button>
  <div id="slide-nav" class="slide-content">
    <button type="button" id="close" class="close-btn" aria-label="close navigation">&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>Slide-Out Navigation Demo</h1>
  <h2>More accessibility tips from <a href="">Knowbility</a></h2>
    <li><a href="">WCAG 2.1</a></li>
    <li><a href="">Skip Links</a></li>
    <li><a href="">Animated Form Labels</a></li>


                body {
  font-family: "Arial", sans-serif;
  background-color: #F5F5F5;
} {
  font-size: 1.5rem;
  border: 1px solid black;
  background-color: transparent;
  margin: 10px;

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

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;

main {
  padding: 0 10%;

main li {
  margin-bottom: 10px;

h1 {
  text-align: center;


                // 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) {