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 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

              
                <header id="header">
  <div id="logo">
    <img src="https://www.pinclipart.com/picdir/big/77-778239_flutes-clipart-krishna-flute-png-transparent-png.png" id="header-img" alt="company-logo" />
    <p>Original Flutes</p>
  </div>
  <nav id="nav-bar">
    <a class="nav-link" href="#features">Features</a>
    <a class="nav-link" href="#how-it-works">How It Works</a>
    <a class="nav-link" href="#pricing">Pricing</a>
  </nav>
</header>
<form id="form" action="https://www.freecodecamp.com/email-submit">
  <h3>Handcrafted, home-made masterpieces</h3>
  <input type="email" id="email" placeholder="Enter your email address" name="email" />
  <input type="submit" id="submit" value="GET STARTED" />
</form>
<section id="features">
  <div class="features-content">
    <i class="fa fa-tree"></i>
    <div>
      <h2>Premium Materials</h2>
      <p>Our flutes use the shiniest tree which is sourced locally.          This will increase the longevity of your purchase.</p>
    </div>
  </div>
  <div class="features-content">
    <i class="fa fa-truck"></i>
    <div>
      <h2>Fast Shipping</h2>
      <p>We make sure you recieve your flute as soon as we have finished making it. We also provide free returns if you are not satisfied.</p>
    </div>
  </div>
  <div class="features-content">
    <i class="fa fa-volume-down"></i>
    <div>
      <h2>Quality Assurance</h2>
      <p>For every purchase you make, we will ensure there are no damages or faults and we will check and test the pitch of your instrument.</p>
    </div>
  </div>
</section>
<section id="how-it-works">
    <iframe width="560" height="315"        src="https://www.youtube.com/embed/yYLQYhH-xDY" frameborder="0" id="video" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-  in-picture" allowfullscreen></iframe>
</section>
<section id="pricing">
  <div class="pricing-item">
    <div class="item-name">
      The Piccolo
    </div>
    <h3>$600</h3>
    <div>
      Lorem ipsum. <br/>
      Lorem ipsum. <br/>
      Lorem ipsum dolor. <br/>
      Lorem ipsum. <br/>
    </div>
    <button class="select-button">SELECT</button>
  </div>
  <div class="pricing-item">
    <div class="item-name">
      The Alto Flute
    </div>
    <h3>$900</h3>
    <div>
      Lorem ipsum. <br/>
      Lorem ipsum. <br/>
      Lorem ipsum dolor. <br/>
      Lorem ipsum. <br/>
    </div>
    <button class="select-button">SELECT</button>
  </div>
  <div class="pricing-item">
    <div class="item-name">
      The Bass Flute
    </div>
    <h3>$1200</h3>
    <div>
      Lorem ipsum. <br/>
      Lorem ipsum. <br/>
      Lorem ipsum dolor. <br/>
      Lorem ipsum. <br/>
    </div>
    <button class="select-button">SELECT</button>
  </div>
</section>
<footer>
  <nav>
    <a href="#">Privacy</a>
    <a href="#">Terms</a>
    <a href="#">Contact</a>
  </nav>
  <div>
    Copyright 2016, Original Flutes
  </div>
</footer>
              
            
!

CSS

              
                body, html {
  margin: 0 auto;
  width: 100%;
}
p {
  margin: 0;
}
#header {
  position: sticky;
  display: flex;
  justify-content: space-between;
  background-color: black;
  color: white;
  width: 100%;
  top: 0;
  z-index: 2;
}

@media screen and (max-width: 600px) {
  #header {
    flex-direction: column;
    margin: 0;
  }
  #header nav {
    text-align: center;
    display: flex;
    flex-direction: column;
    margin: 0;
  }
  #header nav a {
    margin: 0 0 0.5rem 0;
  }
}
#logo {
  display: flex; 
}
#logo p {
  margin-top: 1.9rem;
  margin-left: 2rem;
  text-align: center;
  font-size: 30px;
  font-family: Brush Script MT, Brush Script Std, cursive;
}
#header-img {
  height: 100px;
  transform: rotate(-35deg);
  margin-left: 3rem;
}
#nav-bar {
  margin: 2rem 12rem 0 0;
}
#nav-bar a {
  text-decoration: none;
  margin: 0 3rem 0 0;
  color: white;
  font-family: Lato;
  border-bottom: none;
  padding: 0 0 4px 0;
  transition: border-bottom 200ms ease-in-out;
}

#nav-bar a.active {
  border-bottom: 2px solid white;
}

#form {
  margin: 0 auto;
  width: 500px;
  position: relative;
  margin-bottom: 7rem;
  z-index: 1;
}
#form input {
  display: block;
  margin: 1rem auto;
}
#form #email {
  padding: 5px;
  outline: none;
  border-top-style: none;
  border-left-style: none;
  border-right-style: none;
  color: black;
  border-bottom: 2px solid #8c8c8c;
  transition: all 300ms ease-in-out
}
#form #email:focus,
#form #email:active{
  border-top-style: none;
  border-left-style: none;
  border-right-style: none;
  border-bottom: 2px solid black;
}
#form #submit {
  border: 3px solid black;
  background: white;
  color: black;
  font-weight: 750;
  transition: all 200ms linear;
  cursor: pointer;
}
#form #submit:hover {
  background: black;
  color: white;
}
#form h3 {
  margin: 4rem 0 0 5rem;
  font-family: Andale Mono, monospace;
}
@media screen and (max-width: 600px) {
  #form {
    width: unset;
    margin-bottom: 3rem;
  }
}
#features,
#how-it-works,
#pricing {
  margin: 0 auto;
  display: block;
  width 500px;
}
.features-content {
  margin: 0 auto;
  width: 50%;
  display: flex;
}

.features-content i {
  position: relative;
  bottom: 7px;
  margin: 1.5rem 1.5rem 5rem 3.5rem;
  font-size: 55px;
}
.features-content div h2 {
  margin-bottom: 0;
}
i.fa-volume-down {
  margin-left: 4.4rem;
}
@media screen and (max-width: 600px) {
  .features-content {
    width: 100%;
  }
  
  .features-content i {
    margin: 1.5rem 1rem 5rem 1rem;
  }
  
  i.fa-volume-down {
    margin-left: 1.7rem;
  }
}
#how-it-works iframe {
  margin: 2rem auto 0;
  display: block;
}
#pricing {
  display: flex;
  justify-content: center;
  margin: 6rem 0 0 1rem;
  font-family: Lato;
}
@media screen and (max-width: 600px) {
  #pricing {
    margin: 6rem 1rem 0 1rem;
  }
}
.pricing-item {
  text-align: center;
  border: 1px solid black;
}
.pricing-item *:not(.item-name) {
  padding: 1rem;
}
.pricing-item .item-name {
  background: black;
  color: white;
  padding: 1rem 0;
}
.pricing-item:not(:last-child) {
  margin: 0 5rem 0 0;
}
@media screen and (max-width: 600px) {
  .pricing-item:not(:last-child) {
  margin: 0 1rem 0 0;
}
}

.pricing-item h3 {
  margin: 0;
}

.pricing-item .select-button {
  padding: 0.4rem 1rem;
  margin: 1rem 0;
  border: 1px solid black;
  background: white;
  color: black;
  font-weight: 700;
  transition: all 200ms linear;
  cursor: pointer;
}

.pricing-item .select-button:hover {
  background: black;
  color: white;
}

footer {
  background: black;
  color: white;
  margin: 5rem auto 0;
  width: 40%;
  font-family: Lato;
}

footer nav,
footer div {
  margin-left: 70%;
}

@media screen and (max-width: 600px) {
  footer nav,
  footer div {
    margin-left: unset;
  }
}

footer nav {
  padding: 0.5rem 0 0.3rem 0;
}

footer div {
  padding: 0 0 0.5rem 0;
}

footer nav a:not(:last-child) {
  margin-right: 1.4rem;
}

footer nav a {
  text-decoration: none;
  color: white;
}





              
            
!

JS

              
                function scrollFunction () {
  var elements = document.querySelectorAll("section");
  var navLinks = document.querySelectorAll(".nav-link");
  
  for (var c = 0; c < elements.length; c++) {
    
    if(Math.abs(window.scrollY - elements[c].offsetTop) <= 100) {
 
      navLinks[c].classList.add("active");
      
    } else {
      
      navLinks[c].classList.remove("active");
      
    }
    
  }

} 
window.onscroll = function () {
  scrollFunction();
}
              
            
!
999px

Console