Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <body>
  <header class="l-head">
    <div class="container">
      <div class="row">
        <div class="col-md-12">
          <nav class="navi navbar" role="navigation">
            <a href="#" class="logo">
              Creative E
            </a>
            <ul class="menu nav nav-pills navbar-right">
              <li class="menu__item is-itemHov">HOME</li>
              <li class="menu__item is-itemHov">ABOUT</li>
              <li class="menu__item is-itemHov">SERVICE</li>
              <li class="menu__item is-itemHov">CONTACT</li>
            </ul>
          </nav>
        </div>
      </div>
    </div>
  </header>
    <main class="l-main">
      <div class="container section-1">
        <div class="row">
            <div class="main-msg jumbotron">
              <h1>BootStrap</h1>
              <p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.</p>
              <a class="btn main-msg__btn is-itemHov" href="#" role="button">Download</a>
              <a class="btn main-msg__btn is-itemHov" href="#" role="button">Get Started</a>
            </div>
        </div>
      </div>
    </main>
    <section>
      <div class="container section-2">
        <div class="row">
          
        </div>
      </div>
    </section>
</body>
              
            
!

CSS

              
                @import "compass";
@import url(https://fonts.googleapis.com/css?family=Play);

$navBg: rgba(255,255,255, .6);             // white trans
$is-menuBg:rgba(#AFEEEE, .6);          // white trans


/* Base Styles*/ 

html, body{
  width:100%;
  box-sizing:border-box;
  font-family: 'Play', sans-serif;
}

*, *:before, *:after{
  box-sizing:border-box;
}

a{
  &:link {
    text-decoration: none;
  }
  &:visited {
    text-decoration: none;
  }
  &:hover {
    color:white;
  }
  &:active {
    text-decoration: none;
  }
}

li{
  @include no-bullet;
}


/* Layout Styles*/ 

.l-head{
  position:fixed;
  padding-top:20px;
  width: 100%;
  height:100px;
  transition: all 1s;
}

.l-main{
  width:100%;
  background:url("https://tetonist.files.wordpress.com/2014/04/img_1573.jpg");
  background-repeat:no-repeat;
  background-size:cover;
}
/* Modules Styles*/ 


// .navi{
//   margin-top:20px;  
// }

.logo{
  display:inline-block;
  margin-top:-10px;
  color:white;
  font-size:35px;
  font-weight:bold;
  letter-spacing: 3px;
  text-shadow: 5px 2px 2px black;
}
.menu{
  padding:0px;
  background: $navBg;
  border-radius:5px;
  transition: all 2s;
  &__item{
    margin:0px;
    padding: 10px 20px;
    font-weight:bold;
    text-align:center;
  }
}

.section-1{
  height:768px;
  
}
.section-2{
  height:468px;
}
.main-msg{
  margin-top:150px;
  text-align:center;
  background:rgba(225, 225, 225, .1);
  &__btn{
    margin:10px;
    padding: 10px 20px;
    color:inherit;
    font-weight:bold;
    text-align:center;
    background:rgba(#AFEEEE, .6);
  }
}

/* State Styles*/

.is-menuSmaller{
  padding-top:5px;
  height:50px;
  background:$is-menuBg;
}

.is-itemHov:hover{
  background:white;
}
              
            
!

JS

              
                // listens for scrolling
// once scroll begins, checks user scroll againt cutOff
// class added, when cutOff < user scroll
//class removed, when cutOff > user scroll
function scroll(){
  window.addEventListener("scroll", function(){
    var header = document.querySelector("header"),
        nav = document.querySelector(".menu")
        scrolling = window.scrollY,
        cutOff = 10;
    if (cutOff < scrolling){
      header.classList.add("is-menuSmaller");
      nav.style.backgroundColor = "transparent";
      console.log("test")
    } else {
       header.classList.remove("is-menuSmaller");
       nav.style.backgroundColor = "rgba(225, 225, 225, .6)";
    }
  });
}

scroll();
              
            
!
999px

Console