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">
  
  <img src="https://www.blissfullemon.com/wp-content/uploads/2018/06/DreamCakes.png" alt="header image" id="header-img">
   
  <nav id="nav-bar">
      <a class="nav-link" href="#about">About</a>
      <a class="nav-link" href="#tips">Tips</a>
      <a class="nav-link" href="#products">Products</a>
  </nav>
  
</header>
  
<main>

  <div class="section" id="about">
    
    <div id="hero">
      <div id="hero-textbox">
        <div  class="hero-text">Dream Cakes are all natural, gluten-free desserts with less than five grams of added sugar per serving. They have the same delicious taste with none of the guilt.</div>
      </div>
    </div>
    
  </div>
  
  <div class="section" id="tips">
    <iframe id="video" src="https://www.youtube.com/embed/Np6ewLL86A4" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  </div>
  
  <div class="section" id="products">
    
    <h2>Our Products</h2>
    <div id="product-list">
      <div class="product">Cupcakes</div>
      <div class="product">Muffins</div>
      <div class="product">Cakes</div>
      <div class="product">Doughnuts</div>
      <div class="product">Macaroons</div>
      <div class="product">Fruit Tarts</div>
      <div class="product">Pies</div>
      <div class="product">Cake Pops</div>
    </div>
    
    <div id="registration">
    
      <p>We don't have anything available in your area yet. Sign up for our mailing list to be notified when our items are available for purchase.</p>
    
      <form id="form" action="https://www.freecodecamp.com/email-submit">      
      <input type="email" id="email" name="email" placeholder="Email Address"> 
        <input id="submit" type="submit"></input>
      </form>
  </div>
  </div>

</main>
              
            
!

CSS

              
                #header {
  position: sticky;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  top: 0px;
  height: 50px;
  background-color: rgba(255,255,255,0.9);
  padding: 10px 20px 10px 20px;
  border-bottom: 1px solid black;
}

#header-img {
  float: left;
  width: 200px;
}

#nav-bar {
    display: inline-block;
}

#nav-bar a {
  display: inline-block;
  position: relative;
  top: 6px;
  margin: auto 2px;
  border-radius: 10px;
  background: #6ec0c5;
  color: white;
  padding: 5px 10px;
  font-size: 0.6em;
  text-decoration: none;
  text-transform: uppercase;
}

#nav-bar a:hover {
  background-color: #e375ae;
}


.section {
  min-height: 300px;
}

#hero {
  position: relative;
  margin: 50px auto;
  width: 95%;
  height: 400px;
  overflow: hidden;
    background: url(https://images.unsplash.com/photo-1519869491916-8ca6f615d6bd?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=750783e2b6b6102a8248e3498a9d227f&auto=format&fit=crop&w=1650&q=80) #e375ae;
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: center;
}

#hero-textbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  background-color: rgba(255,255,255,0.9);
  position: relative;
  top: 20px;
  height: 340px;
  margin: auto;
  padding: 7px 20px;
  border: 3px solid white;
}

#hero-textbox {
  width: 350px;
}

.hero-text {
    text-align: center;
    font-size: 120%;
  font-weight: 500;
}

#tips {
  text-align: center;
}

iframe {
  width: 500px;
  height: 280px;
}

#registration {
  width: 40%;
  padding: 20px;
  margin:auto;
  text-align: center;
  border: 2px solid #e375ae;
}

input {
  padding: 10px;
}

#submit {
  background-color: #e375ae;
  border: 1px solid #e375ae;
  color: white;
}

#email {
  width: 70%;
  margin: 10px;
}

#product-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-bottom: 50px;
}

h2 {
  text-align: center;
  color: pink;
  text-transform: uppercase;
}

.product {
  width: 150px;
  margin: 20px;
  text-align: center;
  font-size: 1.2em;
  padding: 20px;
  border-radius: 10px;
  background-color: #F9D78E;
}

@media screen and (max-width: 510px) {
  
  iframe {
    width: 100%;
    height: 280px;
  }
  
  #hero-textbox {
  width: 70%;
  }
  
  .hero-text {
    text-align: center;
    font-size: 100%;
    font-weight: 500;
  }
  
  #header {
    flex-direction: column;
    height: auto;
  }
  
  #header-img {
    margin-bottom: 10px;
  }
  
  #nav-bar a {
    display: block;
    margin: 5px;
    width: 70%;
    text-align: center;
  }
  
    #hero {
    background-size: auto 100%;
    background-position: center;
  }
}

@media screen and (max-width: 720px) {
  #hero {
    background-size: auto 500px;
    background-position: center;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console