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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!doctype html>
<html lang="en">
    <head>
        <title>Google</title>
    </head>
    <body>
        <header>
            <div class="website-name">
                <h1>Google</h1>

                <!-- Visual Design: Visual Content -->
                <img src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="272" height="92"><path fill="#EA4335" d="M115.8 47.2c0 12.7-10 22.2-22.3 22.2s-22.3-9.5-22.3-22.2c0-12.9 10-22.2 22.3-22.2s22.3 9.3 22.3 22.2zm-9.8 0c0-8-5.8-13.5-12.5-13.5S81 39.2 81 47.2c0 7.9 5.8 13.4 12.5 13.4S106 55.1 106 47.2z"/><path fill="#FBBC05" d="M163.8 47.2c0 12.7-10 22.2-22.3 22.2s-22.3-9.5-22.3-22.2c0-12.9 10-22.2 22.3-22.2s22.3 9.3 22.3 22.2zm-9.8 0c0-8-5.8-13.5-12.5-13.5S129 39.2 129 47.2c0 7.9 5.8 13.4 12.5 13.4S154 55.1 154 47.2z"/><path fill="#4285F4" d="M209.8 26.3v39.9c0 16.3-9.7 23-21.1 23a21.1 21.1 0 0 1-19.7-13l8.5-3.6c1.5 3.6 5.2 7.9 11.2 7.9 7.3 0 11.8-4.5 11.8-13v-3.2h-.3c-2.2 2.7-6.4 5-11.7 5a22 22 0 0 1-21.3-22A22 22 0 0 1 188.5 25c5.3 0 9.5 2.4 11.7 5h.3v-3.6h9.3zm-8.6 21c0-7.8-5.2-13.6-11.8-13.6-6.8 0-12.4 5.8-12.4 13.6 0 7.7 5.6 13.3 12.3 13.3 6.7 0 11.9-5.6 11.9-13.3z"/><path fill="#34A853" d="M225 3v65h-9.5V3h9.5z"/><path fill="#EA4335" d="M262 54.5l7.6 5a22 22 0 0 1-18.5 9.8c-12.6 0-22-9.7-22-22.1C229 34 238.6 25 250 25c11.4 0 17 9 19 14l1 2.5L240.4 54a11 11 0 0 0 10.7 6.7c5 0 8.4-2.4 11-6.1zm-23.3-8l19.9-8.2c-1.1-2.8-4.4-4.7-8.3-4.7-5 0-11.8 4.3-11.6 12.9z"/><path fill="#4285F4" d="M35.3 41.4V32H67c.3 1.6.5 3.6.5 5.7 0 7-2 15.8-8.2 22-6 6.3-13.8 9.6-24 9.6A35 35 0 0 1 .3 35 35 35 0 0 1 35.4.5c10.5 0 18 4 23.6 9.5l-6.6 6.6a24.7 24.7 0 0 0-41.7 18.3c0 13.9 10.8 25 24.7 25A23 23 0 0 0 52.7 53a19 19 0 0 0 5-11.6H35.4z"/></svg>' alt="Google Logo" class="google-logo">
            </div>

            <div class="account-action">
                <a href="#">Sign In</a>
            </div>

            <div class="google-apps">
                <div class="app-shortcuts">
                    <ul>
                        <li class="gmail-app"><a href="#">Gmail</a></li>
                        <li class="-app"><a href="#">Images</a></li>
                    </ul>
                </div>

                <div class="all-apps">
                    <span class="google-apps-text">Google Apps</span>
                    <div class="first-section-apps">
                        <ul>
                            <li class="account-app">
                                <a href="#">
                                    <span class="text">Account</span>
                                </a>
                            </li>
                            <li class="search-app">
                                <a href="#">
                                    <span class="text">Search</span>
                                </a>
                            </li>
                            <li class="maps-app">
                                <a href="#">
                                    <span class="text">Maps</span>
                                </a>
                            </li>
                            <li class="youtube-app">
                                <a href="#">
                                    <span class="text">YouTube</span>
                                </a>
                            </li>
                            <li class="play-app">
                                <a href="#">
                                    <span class="text">Play</span>
                                </a>
                            </li>
                            <li class="news-app">
                                <a href="#">
                                    <span class="text">News</span>
                                </a>
                            </li>
                            <li class="gmail-app">
                                <a href="#">
                                    <span class="text">Gmail</span>
                                </a>
                            </li>
                            <li class="contacts-app">
                                <a href="#">
                                    <span class="text">Contacts</span>
                                </a>
                            </li>
                            <li class="drive-app">
                                <a href="#">
                                    <span class="text">Drive</span>
                                </a>
                            </li>
                            <li class="calendar-app">
                                <a href="#">
                                    <span class="text">Calendar</span>
                                </a>
                            </li>
                            <li class="google-plus-app">
                                <a href="#">
                                    <span class="text">Google+</span>
                                </a>
                            </li>
                            <li class="translate-app">
                                <a href="#">
                                    <span class="text">Translate</span>
                                </a>
                            </li>
                            <li class="photos-app">
                                <a href="#">
                                    <span class="text">Photos</span>
                                </a>
                            </li>
                        </ul>
                    </div>

                    <div class="second-section-apps">
                        <ul>
                            <li class="docs-app"><a href="#">Docs</a></li>
                            <li class="books-app"><a href="#">Books</a></li>
                            <li class="hangouts-app"><a href="#">Hangouts</a></li>
                            <li class="keep-app"><a href="#">Keep</a></li>
                            <li class="earth-app"><a href="#">Earth</a></li>
                            <li class="saved-app"><a href="#">Saved</a></li>
                        </ul>
                    </div>

                    <div class="third-section-apps">
                        <a href="#">Even more from Google</a>
                    </div>
                </div>
            </div>
        </header>

        <main>
            <div class="search">
                <div class="search-channels">
                    <form action="#" class="text-search">
                        <label>Search</label>
                        <div class="textbox-skin">
                            <input type="text" title="Search">
                        </div>

                        <div class="search-actions">
                            <button class="google-search-button">Google Search</button>
                            <button class="im-feeling-lucky-button">I'm Feeling Lucky</button>
                        </div>
                    </form>

                    <div class="voice-search">
                        <a href="#" title="Search by voice">
                            <span class="search-by-voice-text">Search by Voice</span>
                        </a>
                    </div>
                </div>
            </div>

            <div class="internationalization">
                <div class="localization">
                    <div class="google-offered-in-text">Google offered in:</div> <a href="#">Cebuano</a>
                </div>

                <div class="current-country-location">
                    <div class="country-text">Philippines</div>
                </div>
            </div>
        </main>

        <footer>
            <div class="secondary-navigation">
                <ul class="primary">
                    <li><a href="#">Advertising</a></li>
                    <li><a href="#">Business</a></li>
                    <li><a href="#">About</a></li>
                </ul>
                <ul class="secondary">
                    <li><a href="#">Privacy</a></li>
                    <li><a href="#">Terms</a></li>
                    <li><a href="#">Settings</a></li>
                </ul>
            </div>
        </footer>
    </body>
</html>
            
          
!
            
              * {
    /* Nature */
    box-sizing: border-box;
}

body {
    /* Visual Design: Colors & Graphic Elements */
    margin: 0;

    /* Visual Design: Layout */
    display: grid;
    grid-template:
        'a1 b1'
        'a2 b2' 1fr
        'a3 b3'
        'a4 b4'
        'a5 b5'
        'a6 b6' 1fr
        'a7 b7'
        'a8 b8'
        / 1fr;
    height: 100vh;
    
    /* Visual Design: Typography */
    font-family: sans-serif;
    font-size: 0.875em;
}

header {
    /* Visual Design: Layout */
    display: contents;
}

main {
    /* Visual Design: Layout */
    display: contents;
}

footer {
    /* Visual Design: Layout */
    display: contents;
}

/* Website Name */
.website-name {
    /* Visual Design: Layout */
    grid-area: a3;
    grid-column: a3 / -1;
    margin: 0 1rem;
    text-align: center;
}

.website-name h1 {
    /* Visual Design: Layout */
    text-align: center;
    display: none;
}

.google-logo {
    /* Visual Design: Layout */
    padding: 1rem 0;
    max-width: 100%;
}

/* Account Action */
.account-action {
    /* Visual Design: Layout */
    grid-area: b1;
    margin-right: 1rem;
}

.account-action a {
    /* Usability: Active Area */
    display: inline-block;
    padding: .65em 1em;
    
    /* Visual Design: Colors & Graphic Elements */
    background-color: #4688f1;
    color: white;
    text-decoration: none;
    border-radius: .125em;
    
    /* Visual Design: Typography */
    font-weight: bold;
}

.account-action a:hover {
    /* Usability: Interactivity */
    box-shadow: 0 2px 2px hsla(0, 0%, 0%, .25);
}

.account-action,
.google-apps {
    /* Visual Design: Layout */
    margin-top: 1rem;
}

/* Google Apps */
.google-apps {
    /* Visual Design: Layout */
    grid-area: a1;
    justify-self: right;
}
.google-apps a {
    /* Usability: Active Area */
    display: inline-block;
    padding: .75em 0;
    
    /* Visual Design: Colors & Graphic Elements */
    color: black;
    text-decoration: none;
}

.google-apps a:hover {
    /* Usability: Interactivity */
    text-decoration: underline;
}

.google-apps ul {
    /* Visual Design: Colors & Graphic Elements */
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-shortcuts {
    /* Visual Design: Layout */
    display: inline-block;
    vertical-align: middle;
}

.app-shortcuts li {
    /* Visual Design: Layout */
    display: inline-block;
    margin: 0 .5rem;
}

.all-apps {
    /* Nature */
    position: relative;

    /* Visual Design: Layout */
    display: inline-block;
    margin-right: .75rem;
    vertical-align: middle;
}

.js-all-apps-active .all-apps:before {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    margin-left: -25%;
    margin-top: 3px;
    width: 0;
    height: 0;
    border: .5rem solid white;
    border-right-color: transparent;
    border-top-color: transparent;
    transform-origin: center center;
    transform: rotate(135deg);
    box-shadow: -2px 2px 1px -1px hsla(0, 0%, 0%, .2);
    z-index: 101;
}

.all-apps .google-apps-text {
    /* Visual Design: Layout */
    display: inline-block;
    margin: 0 .5rem;

    /* Visual Design: Layout */
    display: none;
}

.js-menu-control {
    /* Nature */
    display: block;
    width: 32px;
    height: 32px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><path d="M5 5h22.5v22.5H5zM38.8 5h22.5v22.5H38.8zM72.5 5H95v22.5H72.5zM5 38.8h22.5v22.5H5zM38.8 38.8h22.5v22.5H38.8zM72.5 38.8H95v22.5H72.5zM5 72.5h22.5V95H5zM38.8 72.5h22.5V95H38.8zM72.5 72.5H95V95H72.5z"/></svg>');
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center center;

    /* Visual Design: Colors & Graphic Elements */
    background-color: transparent;
    border: 0;
    opacity: .75;
    outline: none;
}

.js-menu-control:hover {
    /* Usability: Interactivity */
    cursor: pointer;

    /* Visual Design: Colors & Graphic Elements */
    opacity: 1;
}

.js-all-apps-active .js-menu-control {
    /* Visual Design: Colors & Graphic Elements */
    opacity: 1;
}

.js-menu-control:hover .menu-icon {
    /* Visual Design: Colors & Graphic Elements */
    background-color: black;
}

.js-menu-control .js-toggle-text {
    /* Visual Design: Layout */
    display: none;
}

.js-all-apps-container {
    /* Visual Design: Layout */
    visibility: hidden;
    position: fixed;
    right: 0;
    margin: .5rem 1rem 0;
    width: calc(100vw - 2rem);
    max-width: 320px;
    height: 100%;
    z-index: 100;
    
    /* Nature */
    overflow: auto;
    
    /* Visual Design: Colors & Graphic Elements */
    background-color: white;
    border: 1px solid lightgray;
    box-shadow: 0 2px 4px hsla(0, 0%, 0%, .125);
    border-radius: .125em;
}

.js-all-apps-inactive .js-all-apps-container {
    display: none;
}

.js-all-apps-active .js-all-apps-container {
    /* Visual Design: Layout */
    display: block;
    visibility: visible;
    z-index: 100;
}

.first-section-apps ul,
.second-section-apps ul{
    display: flex;
    flex-wrap: wrap;
    padding: 1rem;
}

.first-section-apps li,
.second-section-apps li{
    margin: .5rem 0;
    padding: .5rem;
    padding-bottom: 0;
    width: 33.33%;
    border: 1px solid transparent;
    border-radius: .0625rem;
}

.first-section-apps li:hover,
.second-section-apps li:hover{
    border: 1px solid lightgray;
}

.first-section-apps a,
.second-section-apps a{
    position: relative;
    display: block;
    padding-top: 4.5rem;
    width: 100%;
    min-height: calc( 64px + 2rem);
    text-align: center;
}

.first-section-apps a:hover,
.second-section-apps a:hover{
    text-decoration: none;
}

.first-section-apps a:before,
.second-section-apps a:before{
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translatex(-50%);
    width: 64px;
    height: 64px;
    background-color: hsla(0, 0%, 0%, .0625);
    border-radius: 50%;   
}

.second-section-apps {
    position: relative;
}

.second-section-apps:before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translatex(-50%);
    width: 90%;
    height: 1px;
    background-color: hsla(0, 0%, 0%, .0625);
}

.third-section-apps a {
    display: block;
    padding: .75rem 1rem;
    text-align: center;
}

/* Search */
.search {
    /* Visual Design: Layout */
    grid-area: a4;
    grid-column: a4 / -1;
    justify-self: center;
    margin: auto;
    padding: 0 1rem;
    width: 100%;
    max-width: 480px;
}

.text-search label {
    /* Visual Design: Colors & Graphic Elements */
    display: none;
}

.text-search input {
    /* Usability: Active Area */
    margin: 0;
    padding: 0 .5em;
    font-size: 1rem;
    
    /* Visual Design: Colors & Graphic Elements */
    background-color: transparent;
    border: 0;

    /* Visual Design: Layout */
    position: relative;
    z-index: 1;
    width: 100%;
}

.text-search input,
.text-search .textbox-skin:before {
    /* Usability: Active Area */
    /* Visual Design: Colors & Graphic Elements */
    min-height: 44px;
}

.text-search .textbox-skin {
    /* Visual Design: Layout */
    grid-area: a1;
}

.text-search .textbox-skin:before {
    /* Visual Design: Layout */
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    
    /* Visual Design: Colors & Graphic Elements */
    border: 1px solid lightgray;
    box-shadow: 0 2px 2px hsla(0, 0%, 0%, .0625);
    border-radius: .125em;
}

.text-search .textbox-skin:hover:before {
    /* Usability: Interactivity */
    box-shadow: 0 2px 4px 1px hsla(0, 0%, 0%, .125);
}

.search-actions {
    /* Visual Design: Layout */
    grid-area: a2;
    grid-column: a2 / -1;
    display: flex;
    justify-content: center;
}

.search-actions button {
    /* Usability: Active Area */
    padding: .75em 1em;
    min-height: 44px;

    /* Visual Design: Colors & Graphic Elements */
    background-color: #f2f2f2;
    color: gray;
    font-size: 1em;
    border: 1px solid #e5e5e5;
    border-radius: .125em;
    
    /* Visual Design: Layout */
    margin: 2rem .5rem;
    
    /* Visual Design: Typography */
    font-weight: bold;
}

.search-actions .google-search-button {
    /* Visual Design: Layout */
    margin-left: 0;
}

.search-actions .im-feeling-lucky-button {
    /* Visual Design: Layout */
    margin-right: 0;
}

.search-actions button:hover {
    /* Usability: Interactivity */
    background-color: #fafafa;
    border-color: lightgray;
    box-shadow: 0 2px 2px hsla(0, 0%, 0%, .0625);
}

.voice-search {
    /* Visual Design: Layout */
    grid-area: b1;
    align-self: center;

    /* Visual Design: Layout */
    position: relative;
    z-index: 1;
}

.voice-search a {
    /* Nature */
    display: inline-block;
    min-width: 48px;
    height: 32px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path d="M15 22c2.761 0 5-2.239 5-5v-12c0-2.761-2.239-5-5-5s-5 2.239-5 5v12c0 2.761 2.239 5 5 5zM22 14v3c0 3.866-3.134 7-7 7s-7-3.134-7-7v-3h-2v3c0 4.632 3.5 8.447 8 8.944v4.056h-4v2h10v-2h-4v-4.056c4.5-0.497 8-4.312 8-8.944v-3h-2z"></path></svg>');
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center center;

    /* Visual Design: Colors & Graphic Elements */
    opacity: .75;
    
    /* Usability: Active Area */
    display: inline-block;
    
    /* Visual Design: Layout */
    vertical-align: middle;
}

.voice-search a:hover {
    /* Visual Design: Colors & Graphic Elements */
    opacity: 1;
}

.voice-search .search-by-voice-text {
    /* Visual Design: Layout */
    display: none;
}

.search-channels {
    /* Visual Design: Layout */
    position: relative;
    display: grid;
    grid-template:
        'a1 b1'
        'a2 b2'
        / 1fr;
}

.text-search {
    /* Visual Design: Layout */
    display: contents;
}

/* Internationalization */
.internationalization {
    /* Visual Design: Layout */
    display: contents;
}

.localization {
    /* Visual Design: Layout */
    grid-area: a5;
    grid-column: a5 / -1;
    margin-bottom: 1rem;
    text-align: center;
}

.localization a {
    /* Usability: Active Area */
    display: inline-block;
    padding: .75em 0;

    /* Visual Design: Colors & Graphic Elements */
    color: #1a0dab;
    text-decoration: none;
}

.localization a:hover {
    /* Usability: Interactivity */
    text-decoration: underline;
}

.google-offered-in-text {
    /* Visual Design: Colors & Graphic Elements */
    display: inline-block;
}

.current-country-location {
    /* Visual Design: Layout */
    grid-area: a7;
    grid-column: a7 / -1;
    padding: 0 .5rem;
    
    /* Visual Design: Colors & Graphic Elements */
    background-color: #f2f2f2;
    border-top: 1px solid #e5e5e5;
}

.current-country-location .country-text {
    /* Visual Design: Layout */
    margin: .75em .5rem;
}

/* Secondary Navigation */
.secondary-navigation {
    /* Visual Design: Layout */
    grid-area: a8;
    grid-column: a8 / -1;
    padding: 0 .5rem;
    
    /* Visual Design: Colors & Graphic Elements */
    background-color: #f2f2f2;
    border-top: 1px solid #e5e5e5;
}

.secondary-navigation a {
    /* Usability: Active Area */
    display: inline-block;
    padding: .75em 0;
    
    /* Visual Design: Colors & Graphic Elements */
    text-decoration: none;
}

.secondary-navigation a:hover {
    /* Usability: Interactivity */
    text-decoration: underline;
}

.secondary-navigation ul {
    /* Visual Design: Colors & Graphic Elements */
    list-style: none;
    margin: 0;
    padding: 0;
}

.secondary-navigation a {
    /* Visual Design: Colors & Graphic Elements */
    color: gray;
    
    /* Visual Design: Layout */
    margin: 0 .5rem;
}

.secondary-navigation li {
    /* Visual Design: Layout */
    display: inline-block;
}

@media only screen and ( min-width: 35em ) {
    
    .secondary-navigation {
        /* Visual Design: Layout */
        display: flex;
        justify-content: space-between;
    }
}
            
          
!
            
              var htmlEl = document.documentElement;

function insertAfter( el, referenceNode ) {
    referenceNode.parentNode.insertBefore(el, referenceNode.nextSibling);
}

function offset( el ) {
    var rect = el.getBoundingClientRect(),
    scrollLeft = window.pageXOffset || htmlEl.scrollLeft,
    scrollTop = window.pageYOffset || htmlEl.scrollTop;
    return {
        top: rect.top + scrollTop,
        left: rect.left + scrollLeft
    }
}

var googleAppsTextEl = document.querySelector( '.google-apps-text' ),
    firstSectionAppsEl = document.querySelector( '.first-section-apps' );

// Menu Control
var menuControlEl = document.createElement( 'button' );
menuControlEl.classList.add( 'js-menu-control' );
menuControlEl.setAttribute( 'title', 'Google apps' );
menuControlEl.innerHTML = '<span class="js-toggle-text">Toggle</span>';

// Insert Menu Control
insertAfter( menuControlEl, googleAppsTextEl );

// All Apps Container
var allAppsContainerEl = document.createElement( 'div' );
allAppsContainerEl.classList.add( 'js-all-apps-container' );

// Wrap Elements in All Apps Container
Array.prototype.forEach.call( document.querySelectorAll( '.first-section-apps, .second-section-apps, .third-section-apps' ), function( c ) {
    allAppsContainerEl.appendChild( c );
});

// Insert All Apps Container
insertAfter( allAppsContainerEl, menuControlEl );

// Menu Control Click Event
var menuControlEl = document.querySelector( '.js-menu-control' ),
    allAppsEl = document.querySelector( '.all-apps' );

menuControlEl.addEventListener( 'click', function ( event ) {
    htmlEl.classList.toggle( 'js-all-apps-active' );
}, false);

// Window Click Event
window.addEventListener( 'click', function ( event ) {
	var parentEl = allAppsEl.contains( event.target );
	
    if ( ! parentEl && htmlEl.classList.contains( 'js-all-apps-active' ) ) {
		htmlEl.classList.toggle( 'js-all-apps-active' );
	}
}, false);

// Window Scroll Event
window.addEventListener( 'scroll', function () {
	if ( htmlEl.classList.contains( 'js-all-apps-active' ) ) {
        htmlEl.classList.toggle( 'js-all-apps-active' );
    }
}, false);


// All Apps Container
var allAppsContainerEl = document.querySelector( '.js-all-apps-container' );

var allAppsContainerElOffset = offset( allAppsContainerEl ),
    allAppsContainerElOffsetMargin = allAppsContainerElOffset.top + 16;

allAppsContainerEl.style.cssText += 'max-height: calc(100vh - ' + allAppsContainerElOffsetMargin + 'px' + ' )';

htmlEl.classList.add( 'js-all-apps-inactive' );

/**
 * References
 *
 * Insert After Function
 * https://plainjs.com/javascript/manipulation/insert-an-element-after-or-before-another-32/
 *
 * Offset Function
 * https://plainjs.com/javascript/styles/get-the-position-of-an-element-relative-to-the-document-24/
 */
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console