Product Landing Page - Build a Product Landing Page

How do i get the nav to stay fixed in the top right?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="./styles.css">
</head>
<body>
   <header id='header'>
      <img id='header-img' src=''></img>
</head>
  <div id='page-wrapper'>
    </div>
    <nav id='nav-bar'>
      <ul>
      <li>
        <a class='nav-link' href='#Bio'>Bio</a>
      </li>
      <li>
        <a class='nav-link' href='#What to know'>What to know</a>
      </li>
      <li>
        <a class='nav-link' href='#Pricing'>Pricing</a>
      </li>
      </ul>
      </nav>
       </header>
       <section id='hero'>
         <h2>The best football coaching service</h2>
         <form id='form' action='https://www.freecodecamp.com/email-submit'>
         <input name='email' id='email' type='email' placeholder='Enter your email address' required>
         <input id='submit' type='submit' value='Get started' class='btn'>
         </form>
         </section>
         <div class='container'>
         <section id='features'>
           <div class='grid'>
             <div class='icon'>
               <i class="fa fa-book">
               </i>
               </div>
               <div class='desc'>
                 <h2>Learn from experienced coaches</h2>
                 <p>Our coaches have years of experience working with kids of all ages and providing insightful training</p>
                 </div>
                 </div>
           <div class='grid'>
                 <div class='icon'>
              <i class="fa fa-soccer-ball-o"></i>
               </div>
               <div>
                 </div>
               <div class='desc'>
                 <h2>Brush up on your football technique</h2>
                 <p>It is essential that kids learn the basics and that is what we focus on as they have all the fundamentals in place</p>
                 </div>
                 </div>
 <div class='grid'>
                 <div class='icon'>
              <i class="fa fa-volume-control-phone"></i>
               </div>
               <div class='desc'>
                 <h2>Quality support and service</h2>
                 <p>We will provide our exper service after sessions through regular reports and updates through our progress chart</p>
                 </div>
                 </div>
           </section>
           <section id='training example'>
             <iframe id='video' height='315' src='https://www.youtube.com/watch?v=H5SMtN6Qa6w&pp=ygURZm9vdGJhbGwgdHJhaW5pbmc%3D' frameborder='0' allowfullscreen>
             </iframe>
             </section>
             <section id='pricing'>
               <div class='product' id='1 session'></div>
               <h2>1 session</h2>
               <ol>
                 </ol>
                 <li>£30 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <button class='btn'>Select</button>
                 <div class='product' id='4 sessions'></div>
               <h2>4 sessions</h2>
               <ol>
                 </ol>
                 <li>£25 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <li>Notes sent at the end of session</li>
                 <li>Phone call discussions</li>
                 <button class='btn'>Select</button>
                 <div class='product' id='10 sessions'></div>
               <h2>10 sessions</h2>
               <ol>
                 </ol>
                 <li>£25 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <li>Notes sent at the end of session</li>
                 <li>Phone call discussions</li>
                 <li>Fitness work
                   </li>
                   <li>
                     Nutrition Guide
                   </li>
                 <button class='btn'>Select</button>
               </section>
                <footer>
          <ul>
            <li><a href="#footer">Privacy</a></li>
            <li><a href="#footer">Terms</a></li>
            <li><a href="#footer">Contact</a></li>
          </ul>
          <span>Copyright Football Coaching</span>
        </footer>
      </div>
    </div>
</body>
</html>```

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

```text
Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

Product Landing Page - Build a Product Landing Page

Hello. I believe the position CSS property will help you out a lot.

More about this here.

If you need any further clarification, please let me know.

Happy learning. :slight_smile:

2 Likes

I’ve tried it but i want the navigation to be on one row rather than listed as is.

Can I see your CSS code as well?

2 Likes
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="./styles.css">
</head>
<body>
   <header id='header'>
      <img id='header-img' src=''></img>
</head>
  <div id='page-wrapper'>
    </div>
    <nav id='nav-bar'>
      <ul>
      <li>
        <a class='nav-link' href='#Bio'>Bio</a>
      </li>
      <li>
        <a class='nav-link' href='#What to know'>What to know</a>
      </li>
      <li>
        <a class='nav-link' href='#Pricing'>Pricing</a>
      </li>
      </ul>
      </nav>
       </header>
       <section id='hero'>
         <h2>The best football coaching service</h2>
         <form id='form' action='https://www.freecodecamp.com/email-submit'>
         <input name='email' id='email' type='email' placeholder='Enter your email address' required>
         <input id='submit' type='submit' value='Get started' class='btn'>
         </form>
         </section>
         <div class='container'>
         <section id='features'>
           <div class='grid'>
             <div class='icon'>
               <i class="fa fa-book">
               </i>
               </div>
               <div class='desc'>
                 <h2>Learn from experienced coaches</h2>
                 <p>Our coaches have years of experience working with kids of all ages and providing insightful training</p>
                 </div>
                 </div>
           <div class='grid'>
                 <div class='icon'>
              <i class="fa fa-soccer-ball-o"></i>
               </div>
               <div>
                 </div>
               <div class='desc'>
                 <h2>Brush up on your football technique</h2>
                 <p>It is essential that kids learn the basics and that is what we focus on as they have all the fundamentals in place</p>
                 </div>
                 </div>
 <div class='grid'>
                 <div class='icon'>
              <i class="fa fa-volume-control-phone"></i>
               </div>
               <div class='desc'>
                 <h2>Quality support and service</h2>
                 <p>We will provide our exper service after sessions through regular reports and updates through our progress chart</p>
                 </div>
                 </div>
           </section>
           <section id='training example'>
             <iframe id='video' height='315' src='https://www.youtube.com/watch?v=H5SMtN6Qa6w&pp=ygURZm9vdGJhbGwgdHJhaW5pbmc%3D' frameborder='0' allowfullscreen>
             </iframe>
             </section>
             <section id='pricing'>
               <div class='product' id='1 session'></div>
               <h2>1 session</h2>
               <ol>
                 </ol>
                 <li>£30 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <button class='btn'>Select</button>
                 <div class='product' id='4 sessions'></div>
               <h2>4 sessions</h2>
               <ol>
                 </ol>
                 <li>£25 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <li>Notes sent at the end of session</li>
                 <li>Phone call discussions</li>
                 <button class='btn'>Select</button>
                 <div class='product' id='10 sessions'></div>
               <h2>10 sessions</h2>
               <ol>
                 </ol>
                 <li>£25 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <li>Notes sent at the end of session</li>
                 <li>Phone call discussions</li>
                 <li>Fitness work
                   </li>
                   <li>
                     Nutrition Guide
                   </li>
                 <button class='btn'>Select</button>
               </section>
                <footer>
          <ul>
            <li><a href="#footer">Privacy</a></li>
            <li><a href="#footer">Terms</a></li>
            <li><a href="#footer">Contact</a></li>
          </ul>
          <span>Copyright Football Coaching</span>
        </footer>
      </div>
    </div>
</body>
</html>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #eee;
  font-family: 'Lato', sans-serif;
}

#page-wrapper {
  position: relative;
}

li {
  list-style: none;
}

a {
  color: #000;
  text-decoration: none;
}

.container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.btn {
  padding: 0 20px;
  height: 40px;
  font-size: 1em;
  font-weight: 900;
  text-transform: uppercase;
  border: 3px black solid;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
}

.grid {
  display: flex;
}

header {
  position: fixed;
  top: 0;
  min-height: 75px;
  padding: 0px 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: #eee;
}

@media (max-width: 600px) {
  header {
    flex-wrap: wrap;
  }
}
nav {
  font-weight: 400;
  width: 50%;
  max-width: 300px;
  height: 50px;
}

@media (max-width: 650px) {
  nav {
    margin-top: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 50px;
    position: static;
  }
  nav li {
    padding-bottom: 5px;
  }
}

nav > ul {
  width: 35vw;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  padding-inline-start: 0;
  margin-block: 0;
}

@media (max-width: 650px) {
  nav > ul {
    flex-direction: column;
  }
}

#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 200px;
  margin-top: 50px;
}

#hero > h2 {
  margin-bottom: 20px;
  word-wrap: break-word;
}

#hero input[type='email'] {
  max-width: 275px;
  width: 100%;
  padding: 5px;
}

#hero input[type='submit'] {
  max-width: 150px;
  width: 100%;
  height: 30px;
  margin: 15px 0;
  border: 0;
  background-color: #f1c40f;
}

#hero input[type='submit']:hover {
  background-color: orange;
  transition: background-color 1s;
}

@media (max-width: 650px) {
  #hero {
    margin-top: 120px;
  }
}

#bio {
  margin-top: 30px;
}

#bio .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 125px;
  width: 20vw;
  color: darkorange;
}

@media (max-width: 550px) {
  #bio .icon {
    display: none;
  }
}

#bio .desc {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 125px;
  width: 80vw;
  padding: 5px;
}

@media (max-width: 550px) {
  #bio .desc {
    width: 100%;
    text-align: center;
    padding: 0;
    height: 150px;
  }
}

@media (max-width: 650px) {
  #bio {
    margin-top: 0;
  }
}

#what-to-know {
  margin-top: 50px;
  display: flex;
  justify-content: center;
}

#what-to-know > iframe {
  max-width: 560px;
  width: 100%;
}

#pricing {
  margin-top: 60px;
  display: flex;
  flex-direction: row;
  justify-content: center;
}

.product {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: calc(100% / 3);
  margin: 10px;
  border: 1px solid #000;
  border-radius: 3px;
}

.product > .level {
  background-color: #ddd;
  color: black;
  padding: 15px 0;
  width: 100%;
  text-transform: uppercase;
  font-weight: 700;
}

.product > h2 {
  margin-top: 15px;
}

.product > ol {
  margin: 15px 0;
}

.product > ol > li {
  padding: 5px 0;
}

.product > button {
  border: 0;
  margin: 15px 0;
  background-color: #f1c40f;
  font-weight: 400;
}

.product > button:hover {
  background-color: orange;
  transition: background-color 1s;
}

@media (max-width: 800px) {
  #pricing {
    flex-direction: column;
  }
  .product {
    max-width: 300px;
    width: 100%;
    margin: 0 auto;
    margin-bottom: 10px;
  }
}

footer > ul {
  display: flex;
  justify-content: flex-end;
}

footer > ul > li {
  padding: 0 10px;
}

footer > span {
  margin-top: 5px;
  display: flex;
  justify-content: flex-end;
  font-size: 0.9em;
  color: #444;
}

Your code displays a different error compared to what you reported earlier.

2 Likes

i had added position to the css

This is the error Each .nav-link element should link to a corresponding element on the landing page (has an href with a value of another element's id. e.g. #footer).

To solve this, I created some three divs and gave them an id attribute. The value of the id attribute is the value of the href attributes here.

1 Like

don’t i already have that?

I do not think you have it.

1 Like

I am still missing one step:
Each .nav-link element should link to a corresponding element on the landing page (has an href with a value of another element’s id. e.g. #footer ).

Kindly carefully read my third reply. Just take your time, then make the changes…

1 Like

so i add div element to the nav link?

Let me see the updated code.

1 Like
 <ul>
      <li>
        <a class='nav-link' div='Bio' href='#Bio'>Bio</a>
      </li>
      <li>
        <a class='nav-link' div='what to know' href='#What to know'>What to know</a>
      </li>
      <li>
        <a class='nav-link' div='pricing' href='#Pricing'>Pricing</a>
      </li>

You should not interfere with this code block, do not change anything.

Just create three div elements and give them an id attribute like this.

<div id="Bio"></div>
<div id="what to know"></div>
<div id="pricing"></div>

You see the value of the id elements in the above divs, is the same as the value of the href attributes here.

1 Like
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="./styles.css">
</head>
<body>
   <header id='header'>
      <img id='header-img' src=''></img>
</head>
  <div id='page-wrapper'>
    </div>
    <nav id='nav-bar'>
      <ul>
      <li>
        <a class='nav-link' href='#Bio'>Bio</a>
        <div id="Bio"></div>
      </li>
      <li>
        <a class='nav-link' href='#What to know'>What to know</a>
        <div id="what to know"></div>
      </li>
      <li>
        <a class='nav-link' href='#Pricing'>Pricing</a>
        <div id="pricing"></div>
      </li>
      </ul>
      </nav>
       </header>
       <section id='hero'>
         <h2>The best football coaching service</h2>
         <form id='form' action='https://www.freecodecamp.com/email-submit'>
         <input name='email' id='email' type='email' placeholder='Enter your email address' required>
         <input id='submit' type='submit' value='Get started' class='btn'>
         </form>
         </section>
         <div class='container'>
         <section id='features'>
           <div class='grid'>
             <div class='icon'>
               <i class="fa fa-book">
               </i>
               </div>
               <div class='desc'>
                 <h2>Learn from experienced coaches</h2>
                 <p>Our coaches have years of experience working with kids of all ages and providing insightful training</p>
                 </div>
                 </div>
           <div class='grid'>
                 <div class='icon'>
              <i class="fa fa-soccer-ball-o"></i>
               </div>
               <div>
                 </div>
               <div class='desc'>
                 <h2>Brush up on your football technique</h2>
                 <p>It is essential that kids learn the basics and that is what we focus on as they have all the fundamentals in place</p>
                 </div>
                 </div>
 <div class='grid'>
                 <div class='icon'>
              <i class="fa fa-volume-control-phone"></i>
               </div>
               <div class='desc'>
                 <h2>Quality support and service</h2>
                 <p>We will provide our exper service after sessions through regular reports and updates through our progress chart</p>
                 </div>
                 </div>
           </section>
           <section id='training example'>
             <iframe id='video' height='315' src='https://www.youtube.com/watch?v=H5SMtN6Qa6w&pp=ygURZm9vdGJhbGwgdHJhaW5pbmc%3D' frameborder='0' allowfullscreen>
             </iframe>
             </section>
             <section id='pricing'>
               <div class='product' id='1 session'></div>
               <h2>1 session</h2>
               <ol>
                 </ol>
                 <li>£30 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <button class='btn'>Select</button>
                 <div class='product' id='4 sessions'></div>
               <h2>4 sessions</h2>
               <ol>
                 </ol>
                 <li>£25 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <li>Notes sent at the end of session</li>
                 <li>Phone call discussions</li>
                 <button class='btn'>Select</button>
                 <div class='product' id='10 sessions'></div>
               <h2>10 sessions</h2>
               <ol>
                 </ol>
                 <li>£25 per hour</li>
                 <li>basic training</li>
                 <li>ballwork</li>
                 <li>Notes sent at the end of session</li>
                 <li>Phone call discussions</li>
                 <li>Fitness work
                   </li>
                   <li>
                     Nutrition Guide
                   </li>
                 <button class='btn'>Select</button>
               </section>
                <footer>
          <ul>
            <li><a href="#footer">Privacy</a></li>
            <li><a href="#footer">Terms</a></li>
            <li><a href="#footer">Contact</a></li>
          </ul>
          <span>Copyright Football Coaching</span>
        </footer>
      </div>
    </div>
</body>
</html>```

Does this make sense now?

can somebody help me with this?