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.


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.


                <div class="wrapper">
        <div class="canvas">

            <!-- Aqui fica o menu escondido -->
            <div class="menu">
                <a href="#" class="toggle-menu btn">Fechar o menu</a>
                    <li><a href="#">Link 1</a></li>
                    <li><a href="#">Link 2</a></li>
                    <li><a href="#">Link 3</a></li>

            <!-- Aqui fica o conteúdo do site -->
            <div class="conteudo">
                <a href="#" class="toggle-menu">Abrir o menu</a>
                <h1>Menu Off Canvas!!</h1>
                <p>Uma simples demo mostrando como funciona o menu off canvas.</p>
                <p>Tutorial em <a href=""></a></p>


                * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;

body {
    font-family: sans-serif;
    background: #F6F6F2;

a {
    color: #BF0000;

h1 {
    padding: 25px 0;

p {
    font-size: 18px;
    line-height: 30px;

.wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 3000px; /* só para deixar a página grande*/

.canvas {
    width: 100%;
    height: 100%;
    position: relative;
    transform: translate3d(0);
    transition: .3s ease all;
    backface-visibility: hidden;

.conteudo {
    padding: 8%;

.menu {
    height: 100%;
    position: absolute;
    transform: translate3d(-300px,0,0);
    width: 300px;
    background: #BF0000;
    padding: 5rem;

.menu ul {
    list-style: none;

.menu .btn {
    background: #FFF;
    border-radius: 5px;
    margin-bottom: 30px;

.menu a {
    font-size: 1em;
    display: inline-block;
    padding: 10px;
    color: #FFF;
    text-decoration: none;
} .canvas {
    transform: translate3d(300px,0,0);


                // elementos auxiliares
var toogleMenu = document.querySelectorAll('.toggle-menu'),
    wrapper    = document.querySelector('.wrapper');

// criando evento de click para abrir o menu
for (var i = 0; i < toogleMenu.length; i++){
    toogleMenu[i].addEventListener('click', menuAction);

// Adicionando evento para fechar o menu ao pressionar a tecla ESC
document.addEventListener('keyup', function(e){
    if(e.keyCode == 27) {

// função auxiliar que abre e fecha o menu
function menuAction() {
    else {