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

              
                <!-- Here's an example of a main navigation with framing added to the labels. -->

<!-- <li> doesn't have an end tag to remove the white space between list items. -->

<!-- SVG Icons -->
<svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-home" viewBox="0 0 1024 1024">
	<title>home</title>
	<path class="path1" d="M1024 590.444l-512-397.426-512 397.428v-162.038l512-397.426 512 397.428zM896 576v384h-256v-256h-256v256h-256v-384l384-288z"></path>
</symbol>
<symbol id="icon-profile" viewBox="0 0 1024 1024">
	<title>profile</title>
	<path class="path1" d="M864 0h-768c-52.8 0-96 43.2-96 96v832c0 52.8 43.2 96 96 96h768c52.8 0 96-43.2 96-96v-832c0-52.8-43.2-96-96-96zM832 896h-704v-768h704v768zM256 576h448v64h-448zM256 704h448v64h-448zM320 288c0-53.019 42.981-96 96-96s96 42.981 96 96c0 53.019-42.981 96-96 96s-96-42.981-96-96zM480 384h-128c-52.8 0-96 28.8-96 64v64h320v-64c0-35.2-43.2-64-96-64z"></path>
</symbol>
<symbol id="icon-envelop" viewBox="0 0 1024 1024">
	<title>envelop</title>
	<path class="path1" d="M928 128h-832c-52.8 0-96 43.2-96 96v640c0 52.8 43.2 96 96 96h832c52.8 0 96-43.2 96-96v-640c0-52.8-43.2-96-96-96zM398.74 550.372l-270.74 210.892v-501.642l270.74 290.75zM176.38 256h671.24l-335.62 252-335.62-252zM409.288 561.698l102.712 110.302 102.71-110.302 210.554 270.302h-626.528l210.552-270.302zM625.26 550.372l270.74-290.75v501.642l-270.74-210.892z"></path>
</symbol>
</defs>
</svg>

<nav>
    <h2 class="heading">Main Navigation</h2>
    <ul>
        <li class="nav-item nav-item_home">
            <a href="#" title="Home">
                <span class="label">Home</span>
                <svg class="icon icon-home"><use xlink:href="#icon-home"></use></svg>
            </a>
        <li class="nav-item nav-item_about">
            <a href="#" title="About">
                <span class="label">About</span>
                <svg class="icon icon-profile"><use xlink:href="#icon-profile"></use></svg>
            </a>
        <li class="nav-item nav-item_contact">
            <a href="#" title="Contact">
                <span class="label">Contact</span>
                <svg class="icon icon-envelop"><use xlink:href="#icon-envelop"></use></svg>
            </a>
    </ul>
</nav>
              
            
!

CSS

              
                /* The most important thing to do first in CSS is to pad the links - because increasing a link's active area pertains to usability */

/* Padding - with fixed dimensions */
.nav-item a
{
    display: block;
    width: 64px;
    height: 64px;
    overflow: hidden;
}

/* Now that we have Padding, it's time to layout the elements */
nav ul
{
    list-style: none;
    padding: 0;
}

nav .heading,
.label
{
    display: none; /* In practice, this should be hidden only visually and not from screenreaders and search engine crawlers */
}

.nav-item
{
    display: inline-block; /* To layout the navigation items side-by-side */
}

/* Visual Design */
.nav-item a
{
    color: white;
    background: red;
    text-decoration: none;
}

/* Interactive */
.nav-item a:hover
{
    background-color: blue;
}

/* Icon */
.icon
{
    width: 16px;
    height: 16px;
    fill: white;
}

/* Centering */
.nav-item a
{
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}
              
            
!

JS

              
                
              
            
!
999px

Console