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

              
                .container.example-one
  .title All scrolling
  %header.example-one-header.scroll
    %span.logo Logo
    %span.nav-item Blog
    %span.nav-item Portfolio
    %span.nav-item Downloads
    %span.nav-item About
    %span.nav-item Contact

.container.example-two
  .title Nav only scrolling
  %header.example-two-header
    %span.logo Logo
    %nav.vertical-align-middle.scroll
      %span.nav-item Blog
      %span.nav-item Portfolio
      %span.nav-item Downloads
      %span.nav-item About
      %span.nav-item Contact

.container.example-three
  .title Nav separated
  %header.example-three-header
    %span.logo Logo
  %nav.vertical-align-middle.scroll
    %span.nav-item Blog
    %span.nav-item Portfolio
    %span.nav-item Downloads
    %span.nav-item About
    %span.nav-item Contact
              
            
!

CSS

              
                // Make each area overflow horizontally and
// have the ability to have other items
// scrolled into view
.scroll {
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar; }

// Hide scrollbars, works well with Flickity without downside.
.scroll::-webkit-scrollbar {
  display: none; }

// Example two required styles --------------- /
.example-two-header {
  .logo {
    width: 25%; }
  nav {
    width: 75%; } }

// Example three required styles --------------- /
.example-three {
  .logo,
  nav {
    width: 100%; }
  
  .nav-item {
    color: #f6f7ee; } }

// Shared styles --------------- /
header {
  background: #152637; }

// Examples
.example-one-header,
.example-two-header {
  border-radius: 3px; }

.example-three-header {
  border-radius: 3px 3px 0 0; }

.example-three nav {
  background: #727c87;
  border-radius: 0 0 3px 3px; }

// Logo
.logo {
  text-align: center; // only effective in example 2/3
  font-weight: 700;
  color: #727c87;
  border-right: 1px solid rgba(#727c87, .4);
  padding: 13px 24px 12px; }

// Nav items
.nav-item {
  padding: 13px 16px 12px;

  &:not(:last-child) {
    border-right: 1px solid rgba(#727c87, .2); } }

// Setup/misc styles --------------- /
* { 
  box-sizing: border-box; }

body {
  max-width: 360px;
  margin: 5% auto;
  color: #64cce3;
  line-height: 1.5; }

// Remove the inline-block extra space
header,
nav { 
  font-size: 0; }

// Requires font size to be reset for these elements
.logo,
.nav-item {
  font-size: 14px; }

.logo,
.nav-item,
.vertical-align-middle {
  display: inline-block;
  vertical-align: middle; }

.title {
  margin: 24px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: #999; }

/*! Flickity v1.1.1
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled {
  position: relative; }

.flickity-enabled:focus { 
  outline: none; }

.flickity-viewport {
  position: relative;
  height: 100%; }

.flickity-slider {
  position: absolute;
  width: 100%;
  height: 100%; }

/* Draggable */
.flickity-enabled.is-draggable {
  -webkit-tap-highlight-color: transparent;
          tap-highlight-color: transparent;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none; }

.flickity-enabled.is-draggable .flickity-viewport {
  cursor: move;
  cursor: -webkit-grab;
  cursor: grab; }

.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down {
  cursor: -webkit-grabbing;
  cursor: grabbing; }
              
            
!

JS

              
                function is_touch_device()
{
  // Checks for existence in all browsers and IE10/11 & Surface
  return 'ontouchstart' in window || navigator.maxTouchPoints;
}

var navs = document.querySelectorAll('.scroll');

if (!is_touch_device())
{
  for ( var i = 0, length = navs.length; i < length; i++ ) {
    var nav = navs[i];
    new Flickity( nav, {
      cellAlign: 'left',
      freeScroll: true,
      prevNextButtons: false,
      pageDots: false,
      contain: true
    });
  }
}
              
            
!
999px

Console