Product Landing Page - Build a Product Landing Page

Tell us what’s happening: While working on my product landing page project, i passed most of the user stories except “Your #nav-bar should always be at the top of the viewport”. and I’ve been trying to figure it out, please help

link to my code:
Product Landing Page: Build a Product Landing Page | freeCodeCamp.org

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="ÜTF-8"
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="styles.css">
  <link
      rel="stylesheet"
      href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
      integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
      crossorigin="anonymous"
    />
</head>
<body>
  <div id="page-wrapper">
  <header id="header">
    <div class="logo">
    <img id="header-img" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/product-landing-page-logo.png"  alt="original trombones logo"/>
  </div>
  <nav id="nav-bar">
    <ul>
    <li><a class="nav-link" href="#features">Features</a></li>
    <li><a class="nav-link" href="#how_it_works">How It Works</a></li>
   <li><a class="nav-link" href="#pricing">Pricing</a></li>
   </ul>
   </nav>  
  </header>
      <div class="container"></div>
      <section id="hero">
    <h2>Handcrafted, home-made masterpieces</h2>
    <form id="form" action="https://www.freecodecamp.com/email-submit">
    <input id="email" placeholder="Enter your email address" type="email" name="email" required>
    <br><input id="submit" type="submit" value="GET STARTED" class="btn"/></br>
    </form>
    </section>

    <div class="container">
    <section id="features">
    <div class="grid">
    <div class="icon"><i class="fa fa-3x fa-fire"></i></div>
    <div class="desc">
    <h2>Premium Materials</h2>
    <p>Our trombones use the shiniest brass which is sourced locally. This will increase the longevity of your purchase.</p>
    </div>
          </div>
          <div class="grid">
            <div class="icon"><i class="fa fa-3x fa-truck"></i></div>
            <div class="desc">
    <h2>Fast Shipping</h2>
    <p>We make sure you recieve your trombone as soon as we have finished making it. We also provide free returns if you are not satisfied.</p>
    </div>
          </div>
          <div class="grid">
            <div class="icon">
              <i class="fa fa-3x fa-battery-full" aria-hidden="true"></i>
            </div>
            <div class="desc">
    <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 height="240" id="video" src="https://www.youtube-nocookie.com/embed/y8Yv4pnO7qc?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen type="video/mp4" >
    </iframe>
    </section>
    <section id="pricing">
          <div class="product" id="tenor">
            <div class="level">Tenor Trombone</div>
            <h2>$600</h2>
            <ol>
              <li>Lorem ipsum.</li>
              <li>Lorem ipsum.</li>
              <li>Lorem ipsum dolor.</li>
              <li>Lorem ipsum.</li>
            </ol>
            <button class="btn">Select</button>
          </div>
          <div class="product" id="bass">
            <div class="level">Bass Trombone</div>
            <h2>$900</h2>
            <ol>
              <li>Lorem ipsum.</li>
              <li>Lorem ipsum.</li>
              <li>Lorem ipsum dolor.</li>
              <li>Lorem ipsum.</li>
            </ol>
            <button class="btn">Select</button>
          </div>
          <div class="product" id="valve">
            <div class="level">Valve Trombone</div>
            <h2>$1200</h2>
            <ol>
              <li>Plays similar to a Trumpet</li>
              <li>Great for Jazz Bands</li>
              <li>Lorem ipsum dolor.</li>
              <li>Lorem ipsum.</li>
            </ol>
            <button class="btn">Select</button>
          </div>
        </section>
        <footer>
          <ul>
            <li><a href="#">Privacy</a></li>
            <li><a href="#">Terms</a></li>
            <li><a href="#">Contact</a></li>
          </ul>
          <span>Copyright 2016, Original Trombones</span>
        </footer>
      </div>
    </div>
</body>
</html>
* {
  background-color: #ff7f50;
}
img {
  width: 100%;
  object-fit: cover;
}
h2, p {
  font-family: 'Raleway', sans-serif;
}
a {
  text-decoration: none;
  color: linen;
}
#hero {
  grid-column: 1 / -1;
  position: relative;
  text-align: center;
}
header {
justify-content: flex-end;
position: positioned;
display: flex;
flex-direction: row;
flex-wrap: none;
width: 100%;
top: 0;
left: 0;
  padding: 1em;

}
@media only screen and (max-width: 720px) {
  .image-wrapper {
    grid-template-columns: 1fr;
  }
  i {
    color: yellow;
  }
  #submit {
    background-color: yellow;
  }
  input {
    font-weight: bold;
    font-szie: 15;
  }
  .btn {
    color: blue;
    padding-top: 
  }
  

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.71

Challenge: Product Landing Page - Build a Product Landing Page

Link to the challenge:

That’s the link to the project, we can’t see your code. You need to manually copy/paste your HTML and CSS, using the “Preformatted text” (put your code between the 3 ‘’’ ‘’').

1 Like

I’ve included it, Thank you.

You need to fix your #nav-bar up top. You can select your nav element only with the #id selector. You can use “position: fixed” to fix the position, and “top: 0px” to position it at the top of its element.

To select the nav element:
#nav-bar {
}

Change these properties:
position: fixed;
top: 0px;
4 Likes

Dang! It worked like magic, Thanks alot!

A post was split to a new topic: Product Landing Page - Build a Product Landing Page

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.