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

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.

HTML

              
                - items = ['About', 'Products', 'News', 'Contact']
body
  header Logo
    nav.pull-right
      ul.list-inline
          each item in items
            li
              a(href='#')=item
  main 請往下滑動,再往上滑動,觀看效果
  footer I am footer
              
            
!

CSS

              
                header
  background-color: #fff
  padding: 15px 40px
  height: 48px
  position: fixed
  top: 0
  width: 100%
  box-sizing: border-box
  transition: top .4s ease-in-out
  box-shadow: 0 0 8px rgba(0,0,0,.2)
  .hideUp &
    top: -48px

main
  height: 1200px
  padding: 100px 40px
  color: #fff
  font-size: 24px

footer
  background-color: #fff
  padding: 20px 40px
  
body
  padding : 0
  margin: 0
  background: #149
  color: #888
              
            
!

JS

              
                var bodyClass = document.body.classList,
    lastScrollY = 0;
window.addEventListener('scroll', function(){
  var st = this.scrollY;
  // 判斷是向上捲動,而且捲軸超過 200px
  if( st < lastScrollY) {
    bodyClass.remove('hideUp');
  }else{
    bodyClass.add('hideUp');
  }
  lastScrollY = st;
});
              
            
!
999px

Console