Product Landing Page - Build a Product Landing Page

Tell us what’s happening:

help! tried so many different ways of writing this but it keeps coming back telling me that the nav-bar should always be at the top of the viewport…what am I doing wrong?

Your code so far

<!-- file: index.html -->

/* file: styles.css */

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/18.0 Safari/605.1.15

Challenge Information:

Product Landing Page - Build a Product Landing Page

unfortunately we can’t see your code.
You can try setting the display to fixed for your nav-bar and the top to 0

Hi thank you. I tried this. I reposted the codepen and adding my code below…

<!DOCTYPE html>
<html lang="en">

<html>
<head>
  <meta charset='UTF-8'>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" media="screen and (min-width: 480px)" href="styles.css"> 
<title>Product Landing Page</title>
</head>

<body>


<div id="page-wrapper">

<section id="navsection">

<header id="header" class="nav-header">

    <div class="logo">

  <img src="https://img.freepik.com/premium-vector/fitness-logo-letter-f-gym-fitness-f-letter-sign-vector-template_754537-5784.jpg?w=1800" id="header-img" alt="header-img" width="150" height="150">
</div>

<nav class="nav-bar" id="nav-bar">

    <a class="nav-link" href="#Hiit" id="#Hiit">Hiit</a>
   

    <a class="nav-link" href="#Circuit-Training"id="#Circuit-Training"> Circuit Training</a>
  
    <a class="nav-link" href="#strength-training" id="#strength-training"> Strength Training</a>
    
    <a class="nav-link" href="#Yoga" id="#Yoga">Yoga</a>


</nav>
</header>
</section>

<main id="main-doc">

  <section id="hero">
  

      <h1>Fitness Friend</h1>
  </section>

      <img src="https://onnitacademy.imgix.net/2015/11/absworkout1.jpg" href="hero-img" id="hero-img" alt="hero-img">

      </section>


  <section id="Hiit">

    <h1>
      Hiit Lessons
      </h1>

    <p>
      Join our instructors for live or recorded video tutorials for Hiit classes for High Intensity Interval Training.
    </p>

      <iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=adDGcsdu8WY">
</iframe>


    </section>

    <section id="Circuit-Training">
      
      <h1>Curcuit Training</h1>
        <p>
      Join our instructors for live or recorded video tutorials of Cicuit Training. Weights or body weight training, there is something for everyone to get their blood pumping and their heatbeat raised.
    </p>

    <iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=adDGcsdu8WY">
</iframe>
      </section>
      
      
      <section id="strength-training">
       
      <h1>Strength Training</h1>
        <p>
      Join our instructors for live or recorded video tutorials of Cicuit Training. Weights or body weight training, there is something for everyone to get their blood pumping and their heatbeat raised.
    </p>

    <iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=adDGcsdu8WY">
</iframe>

 <iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=A5CWlen5N2I&t=433s">
</iframe>


      </section>

      <section id="Yoga">

      <h1>Yoga</h1>
      <div class="Yoga" id="Yoga">
        <p>
      Join our instructors for live or recorded video tutorials of Cicuit Training. Weights or body weight training, there is something for everyone to get their blood pumping and their heatbeat raised.
    </p>

    <iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=adDGcsdu8WY">
</iframe>

<iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=adDGcsdu8WY">
</iframe>

<iframe width="420" height="315" id="video"
src="https://www.youtube.com/watch?v=LZNcKO0N76I">
</iframe>

      </section>

      <section id="Signup">

  <form id="form" action="https://www.freecodecamp.com/email-submit">

    <h1>Sign Up for Our Channel</h1>
    <input type="email" id="email" name="email" placeholder="email address" required>
    </input>

    <input type="submit" id="submit" action="https://www.freecodecamp.com/email-submit"></input>
    <button id="subscribe">Subscribe</button>

  </form>
  </section>


</div>





</main>
</body>
</html>
@media screen and (min-width: 480px) {

body{
  color: white;
  background-color: #121212;
  overflow: visible;
}



header{
  z-index: 2;
  position: fixed;
  top: 0;
}

nav{
  display: flex;
   position: fixed;
  top: 0;
   flex-direction: row;
   justify-content: center;
  align-items: center;
  padding-left: 400px;
 
}

.nav-header{
  position: fixed; 
  top: 0;
  display: flex;
   flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background-color: #121212;
  width: 100%;
   min-width: 64px;
  min-height: 75px;

}

#navbar{
  position: fixed;
  top: 0;

}

.nav-link{
 display: flex;
 top: 0;
 justify-content: center;
 flex-direction: row;
 unicode-bidi: isolate;
 font-weight: 400;
 padding: 16px;
 color: orange;
 font-size: 24px;
 text-decoration: none;

}



.nav-link:hover{
  color: white;

}

h1{
  font-size: 64px;
  align-items: center;
  justify-content: center;
  display: flex;

}
#main-doc{
  position: absolute;
  top: 300px;
  z-index: 1;
}

#hero-img{
  display: flex;
  width: 100%;

}

input:invalid {
  type: phone;

}

input:valid {
  type: email;

}

your codepen link shows nothing for me! Please check?

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Welcome to the forum @taylerplace

Try removing the media attribute from the link element.

Happy coding

3 Likes

This worked! Thank you. Can you tell me why it specifically should not be applied to the link elements in this case? I am finding conflicting information when searching for a reason to avoid this for future code.

1 Like

Hi there!

Because the freecodecamp challenge test is specific about the instructions. The challenge wants you to use media query within the css file only.

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