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


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.


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.

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.


   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <nav role="navigation">
      <ul class="menu">
         <li><a href="#">Link 1</a></li>
         <li><a href="#">Link 2</a></li>
         <li><a href="#">Link 3</a></li>
         <li><a href="#">Link 4</a></li>
         <li><a href="#">Link 5</a></li>
   <!-- Main container -->
   <main class="main-container" role="main">
      <h1>The Flexbox-based Navigation</h1>
      <p>On both <strong>small and large screens</strong> the menu and its items are always visible.</p>
      <p>However, on <strong>small screens</strong> the links are more clearly defined and occupy all the available space.</p>


                *, *:before, *:after { box-sizing: border-box; }
//Mobile-first Media Query Mixin
@mixin forLargeScreens($media) {
  @media (min-width: $media/16+em) { @content; }
//Menu itself
.menu {
   display: flex;
   flex-wrap: wrap;
   justify-content: space-around;
   max-width: 980px;
   margin: auto;
   padding: 2px;
   list-style: none;
   border: #999 1px dotted;
   //List items
   li {
      //Expand to use any available space
      //flex-grow: 1;
      //flex-basis: 100%;
      flex: 1 100%;
      margin: 3px;
      text-align: center;
      @include forLargeScreens(320) {
         flex-basis: 30%;
      @include forLargeScreens(426) {
         flex-basis: 0;
      //Links themselves
      a {
         display: block;
         padding: 1em;
         color: #2963bd;
         text-decoration: none;
         background: #eee;
         @include forLargeScreens(426) {
            background: none;
//Main Container
.main-container {
   max-width: 980px;
   margin: auto;
   padding: 20px;
   background: #eee;

//Styling stuff not needed for demo
body { margin: 8px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; }
p { line-height: 1.5; }
h1 { margin: 0; }