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

              
                <body>
    <!-- screen one -->
    <div class="screen1_container">
        <!-- The nav bar with logo and menu items-->
        <nav class="screen1_menu_container">
            <h4>Logo</h4>
            <label for="screen1_menu_check" class="screen1_menu_btn">

                <!-- checkbox to track when the hamburger menu is clicked on -->
                <input 
                class="screen1_input"
                type="checkbox"
                id="screen1_menu_check"
                />

                <!-- the hamburger menu -->
                <div class="screen1_menu_hamburger"></div>

                <!-- menu items -->
                <ul class="screen1_menu_items">
                    <li>Home</li>
                    <li> 
                        <!-- sub menu items -->
                        <label for="screen1_submenu_check">
                            <p>About &downarrow; </p>

                            <input 
                            type="checkbox"
                            id="screen1_submenu_check"
                            class="submenu_input"
                            />
                            
                            <ul class="screen1_submenu">
                                <li>Careers</li>
                                <li>Policy</li>
                                <li>
                                    <!-- second level sub menu items -->
                                    <label for="screen1_submenu2_check">
                                        <p>More &downarrow; </p>
            
                                        <input 
                                        type="checkbox"
                                        id="screen1_submenu2_check"
                                        class="submenu2_input"
                                        />
                                        
                                        <ul class="screen1_submenu2">
                                            <li>Office</li>
                                            <li>Hangouts</li>
                                        </ul>
                                    </label>
                                </li>
                            </ul>
                        </label>
                       
                    </li>
                    <li>Contact</li>
                </ul>
            </label>
        </nav>

        <!-- The page body content for screen one -->
        <div class="page_content">
            <h3>This is the first screen</h3>
            <p>We are creating animated mobile menus</p>
        </div>
    </div>
    <!-- end of screen one -->


    <!-- screen two -->
    <div class="screen2_container">
        <!-- The nav bar with logo and menu items-->
        <nav class="screen2_menu_container">
            <h4>Logo</h4>
            <label for="screen2_menu_check" class="screen2_menu_btn">

                <!-- checkbox to track when the hamburger menu is clicked on -->
                <input 
                type="checkbox"
                id="screen2_menu_check"
                class="screen2_input"
                />

                <!-- the hamburger menu -->
                <div class="screen2_menu_hamburger"></div>

                <!-- menu items -->
                <ul class="screen2_menu_items">
                    <li>Home</li>
                    <li>About</li>
                    <li>Contact</li>
                </ul>
            </label>
        </nav>

        <!-- The page body content for screen two -->
        <div class="page_content">
            <h3>This is the second screen</h3>
            <p>We are creating animated mobile menus</p>
        </div>
    </div>
    <!-- end of screen two -->
</body>

              
            
!

CSS

              
                *{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: 40px;
    min-height: 100vh;
    color: white;
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

@media screen and (max-width: 600px){
    body{
        flex-direction: column;
        row-gap: 40px;
        margin-top: 40px;
    }
}

/*screen one styles  */

.screen1_container{
    width: 350px;
    height: 700px;
    background-color: #533557;
    position: relative;
    overflow: hidden;
    border: 15px solid rgb(54, 53, 53);
    border-top: 30px solid rgb(54, 53, 53);
    border-bottom: 30px solid rgb(54, 53, 53);
    border-radius: 60px;
}
.screen1_menu_container{
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f1d6f5;
    color: #533557;
    padding: 0 10px;
}
.screen1_menu_btn{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    transition: all .5s ease-in-out;
}
.screen1_menu_hamburger{
    width: 20px;
    height: 2px;
    background-color: #533557;
    border-radius: 5px;
    z-index: 10;
    transition: all .5s ease;
}

.screen1_menu_hamburger::before,
.screen1_menu_hamburger::after{
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #533557;
    border-radius: 5px;
    transition: all .5s ease;
}
.screen1_menu_hamburger::before{
    transform: translateY(-6px);
}
.screen1_menu_hamburger::after{
    transform: translateY(6px);
}
.screen1_menu_items{
    background:  #f1d6f5;
    color: #533557;
    position: absolute;
    left: 100%;
    height: 100%;
    width: 70%;
    padding-top: 70px;
    padding-left: 20%;
    top: 0;
    transition: all .5s ease-in-out;
}
.screen1_menu_items li{
    padding: 10px 0;
    /* text-align: center; */
    transition: all .2s ease; 
    list-style-type: none;
    cursor: pointer;
}

/* animation */
.screen1_input:checked ~.screen1_menu_hamburger{
    transform: translateX(-50px);
    background: transparent;
}
.screen1_input:checked ~.screen1_menu_hamburger::before{
    transform: rotate(45deg) translate(35px, -35px);
}
.screen1_input:checked ~.screen1_menu_hamburger::after{
    transform: rotate(-45deg) translate(35px, 35px);
}
.screen1_input:checked ~.screen1_menu_items{
    left: 40%;
}
.screen1_input{
    display: none;
}
.page_content{
    text-align: center;
    margin-top: 3em;
}
.page_content h3{
    padding-bottom: 10px;
}


/* sub menu styles */
.submenu_input{
    display: none;
}
.screen1_submenu{
    position:relative;
    left: 100%;
    transition: all .5s ease-in-out;
    height: 0;
    padding-left: 10%;
}
.screen1_submenu li{
    text-decoration: underline;
}
.submenu_input:checked ~.screen1_submenu{
    left: 0;
    height: auto;
    margin-top: 10px;
}

/* second level sub menu styles */
.screen1_submenu2{
    position:relative;
    left: 100%;
    transition: all .5s ease-in-out;
    height: 0;
    padding-left: 10%;
}
.submenu2_input{
    display: none;
}
.submenu2_input:checked ~.screen1_submenu2{
    left: 0;
    height: auto;
    margin-top: 10px;
}

/* media query */
@media screen and (max-width: 600px){
    .screen1_container{
        width: 300px;
        height: 600px;
    }
}

/*screen two styles  */
.screen2_container{
    width: 350px;
    height: 700px;
    position: relative;
    overflow: hidden;
    color: rgb(54, 53, 53);
    border: 15px solid rgb(54, 53, 53);
    border-top: 30px solid rgb(54, 53, 53);
    border-bottom: 30px solid rgb(54, 53, 53);
    border-radius: 60px;
}
.screen2_menu_container{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    background-color: #533557;
    color: white;
}
.screen2_menu_btn{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    transition: all .5s ease-in-out;
}
.screen2_menu_hamburger{
    width: 20px;
    height: 2px;
    background-color: white;
    border-radius: 5px;
    z-index: 10;
    transition: all .5s ease;
}
.screen2_menu_hamburger::before,
.screen2_menu_hamburger::after{
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 5px;
    transition: all .5s ease;
}
.screen2_menu_hamburger::before{
    transform: translateY(-6px);
}
.screen2_menu_hamburger::after{
    transform: translateY(6px);
}

.screen2_input:checked ~.screen2_menu_hamburger::before{
    transform: rotate(45deg) translate(35px, -35px);
}
.screen2_input:checked ~.screen2_menu_hamburger::after{
    transform: rotate(-45deg) translate(35px, 35px);
}
.screen2_input:checked ~.screen2_menu_hamburger{
    transform: translateX(-50px);
    background: transparent;
}

.screen2_menu_items{
    position: absolute;
    top: -100%;
    background:  #533557;
    height: 100%;
    width: 100%;
    left: 0;
    transition: all .5s ease-out; 
    padding-top: 50px;
}
.screen2_menu_items li{
    border-bottom: .5px solid rgb(182, 181, 181);
    padding: 24px 0;
    text-align: center;
    transition: all .2s ease-out; 
    cursor: pointer;
}
.screen2_menu_items li:hover{
    letter-spacing: 2px;
    opacity: .6;
}

.screen2_input:checked ~.screen2_menu_items{
    top:0;
}
.screen2_input{
    display: none;
}

@media screen and (max-width: 600px){
    .screen2_container{
        width: 300px;
        height: 600px;
    }
}



              
            
!

JS

              
                
              
            
!
999px

Console