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

              
                header
    a.toggle-link(href='#menu') #[i.fa.fa-navicon] Menu
    nav.main-menu#menu
        a.toggle-link(href='#menu')
            i.fa.fa-close
        each val in [1, 2, 3, 4, 5]
            a(href='index'+val+'.html')= 'Item ' + val
              
            
!

CSS

              
                // point at which menu turns to off-canvas
$menu_collapse: 500px;

// basic styling
body {
    font: {
        size: 22px;
        weight: 300;
        family: Roboto;
    }
    line-height: 1.8;
    color: #333;
}

header{
    width: 100%;
    position: relative;
    left: 0;
    top: 0;
    background: darken(white, 15%);
}
a {
    text-decoration: none;
    color: black;
    transition: .3s;
    &:hover {
        color: lighten(black, 50%);
    }
}

// menu style
.main-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    
    // change the way links appear with flex-direction
    
    // on a horizontal line in non-collapsed way
    @media screen and (min-width: $menu_collapse) {
        flex-direction: row;
        justify-content: space-between;
        max-width: 800px;
        
        .toggle-link {
            display: none;
        }
    }
    
    // off-canvas look
    @media screen and (max-width: $menu_collapse) {
        // make links appear underneath each other
        flex-direction: column;
        justify-content: flex-start;
        
        // off-canvas style, closed
        background: darken(white, 10%);
        z-index: 100;
        width: 320px;
        min-height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        transition: .3s all linear;
        box-sizing: border-box;
        padding: 10px;
        transform: translateX(-320px);
        
        // off-canvas, open
        &.active {
            transform: translateX(0px);
        }
        
        // position "x" in the upper right-hand corner
        .toggle-link {
            align-self: flex-end;
        }
    }
}

// make toggle links visible if off-canvas menu is to be displayed
header {
    .toggle-link {
        @media screen and (min-width: $menu_collapse) {
            display: none;
        }
    }
}
              
            
!

JS

              
                $(document).ready(function () {
    $(".toggle-link").click(function () {
        $("#menu").toggleClass("active");
    });
});
              
            
!
999px

Console