Product Landing Page - Build a Product Landing Page

Tell us what’s happening:

Hi ! There’s something going on with my nav element, the errors that are getting thrown are:

  1. each .nav-link element should have an href.

  2. each .nav-link element should link to the corresponding element on the landing page.
    Everything but my instruction video is connecting*

3.Your #nav-bar should always be at the top of the viewport
**My nav bar is at the top.

I am open to all other advise as well. Thank you!

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport"content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link rel="stylesheet" href="styles.css">
  <title>Product Landing Page Project</title>
</head>

<body>

<header id="header"> 

<nav id="nav-bar" class="nav-bar">
  <ul>
   <li class="nav-link"><a href="#Features">Features</a></li>
   <li class="nav-link"><a href="#instruction-vid">How it Works
     </a></li>
   <li class="nav-link"><a href="#Pricing">Pricing</a></li>
  </ul>  
</nav>


 <h1>Hands-Free Dog Leash </h1>

    <form id="form" action="https://www.freecodecamp.com/email-submit">
<input id="email" placeholder="Enter Email Address" required type="email" name="email"></input>
<input id="submit" type="submit"></input>
</form>
  <div>
  
  <img src="https://reviewed-com-res.cloudinary.com/image/fetch/s--VD-rEa7l--/b_white,c_limit,cs_srgb,f_auto,fl_progressive.strip_profile,g_center,q_auto,w_972/https://reviewed-production.s3.amazonaws.com/1714158134000/20240426_handsfreeleashHero.jpg" id="header-img" height="450px" alt="brown chiuahua in pink hands free leash harness laying on brindge in NYC">

</header>

<ol class="Features" id="Features">
  <li>
    <h2>Versatility</h1>
    <p>It can be worn around the waist or shoulder using our ultra resistant hardware, or even as a regular leash. 3 different ways to use. 4 colors to choose from.</p>
  </li>
  <li>
    <h2>Fast Shipping</h1>
    <p>Our current processing time is less than 24 hours!</p>
  </li>
  <li>
    <h2>Quality Assurance</h1>
    <p>Custom woven nylon webbing, Clips have screw fastening for added security</p>
  </li>
</ol>


<iframe width="950" height="534" src="https://www.youtube.com/embed/BTmtIW42K9s" title="How To Correctly Use A Hands-Free Leash" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen id="video" class="instruction-vid"/></iframe>

</body>

<ul class="Pricing" id="Pricing">
  <li>
    <h2>Hands Free Leash</h2>
    <p>Adjustable shoulder and waist attachment piece and
    Leash attachment</p>
    <h3>$30</h3>
  </li>
  
  <li>
    <h2>Hands Free Leash & Harness</h2>
    <p>Made with the softest neoprene you’ve ever felt! Front & back D-ring placements for convenient latching and fastening.</p>
    <h3>$40</h3>
  </li>

  <li>
    <h2>Hands Free Walking Kit</h2>
    <p>Get everything you need with the Hands Free Leash, the ultra versatile harness, and the Treat Round Pouch to hold your dog walking essentials!</p>
    <h3>$50</h3>
  </li>
</ul>

<footer></footer>
</html>
/* file: styles.css */
#nav-bar ul{
  list-style-type:none;
  background-color:grey;
  padding:0;
  margin:0px;
  overflow:hidden;
}

#nav-bar a{
  color:white;
  text-decoration:none;
  padding:15px;
  display:block;
}

#nav-bar a:hover{
  background-color:pink
}

.nav-bar li{
  float:right;
}

header{
  text-align:center;
  font-size:20px;
}


h1{
  text-align:center;
  border-style:dotted;
}

#form{
  text-align:center;
}

ul{
  list-style-type:none;
  display:flex;
}

@media(max-width:960px){
  img{
    padding:2rem;
  }
}

ol{
  list-style-type:none;
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15

Challenge Information:

Product Landing Page - Build a Product Landing Page

This is an li element. They wanted the nav-link elements to be anchor elements.

Also: I would move the navbar element so it is the first child element in the body and not put it inside the header.
Then I would set its display to absolute and its top to 0.

1 Like

Hi,
For your first error, it says each .nav-link should have an href, which means both of them should be on the same element. You have your nav-link on the li and the href on your a elements.
The second error as you say is with the video, try connecting that too, and see if shows the same error again.

The third part means your nav-bar should always be on the top even when you scroll. It means your nav-bar should have a fixed position added to the styles.
Hope this helps!

3 Likes

Hello @ceejay !

Here is a code validation link that can be used to check both your HTML and your CSS code.

https://validator.w3.org/nu/#textarea

I use it and make the corrects within the code in the validator until it is all green. Then, I copy and paste that back into my html, or CSS (CSS is not usually my issues).

Then, run it and see what I am still not meeting or if it passes the requirements.

Hopefully, this can help you on your coding journey. :slightly_smiling_face:

2 Likes

Thank you so much for this resource! I was able to get it working!

1 Like

I appreciate your help! I was able to pass!

2 Likes

That is good to hear.

Keep up the good progress! :slightly_smiling_face:

1 Like