Html/css - product landing page

My #nav-bar refused to be at top-right of the header, it stuck at the middle… I need some help with my css.

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="styles.css"/>
    <title>Product Landing Page</title>
  </head>
  <body>
    <div id="page-layout">
      <header id="header">
        <div class="logo">
          <img src="https://cdn.freecodecamp.org/testable-projects-fcc/images/product-landing-page-logo.png" id="header-img"/>
        </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>
      <section id="hero">
        <h2>Handcrafted, home-made masterpieces</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-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 id="How_It_Works">
      <iframe id="video" width="420" height="315" src="https://www.youtube-nocookie.com/embed/y8Yv4pnO7qc?rel=0&amp;controls=0&amp;showinfo=0" allowfullscreen frameborder="0">
      </iframe>
    </section>
    <section id="pricing">
      <div id="tenor" class="product">
        <h4 class="card-title">TENOR TROMBONE</h4>
          <h3 class="card-subtitle">$600</h3>
          <ol class="card-text">
            <li>Lorem ipsum.</li>
            <li>Lorem ipsum.</li>
            <li>Lorem ipsum dolor.</li>
            <li>Lorem ipsum.<li>
          </ol>
          <button type="select">Select</button>
      </div>
      <div id="bass" class="product">
        <h4 class="card-title">BASS TROMBONE</h4>
          <h3 class="card-subtitle">$900</h3>
          <ol class="card-text">
            <li>Lorem ipsum.</li>
            <li>Lorem ipsum.</li>
            <li>Lorem ipsum dolor.</li>
            <li>Lorem ipsum.<li>
          </ol>
          <button type="select">Select</button>
      </div>
      <div id="valve" class="product">
        <h4 class="card-title">VALVE TROMBONE</h4>
          <h3 class="card-subtitle">$1200</h3>
          <ol class="card-text">
            <li>Plays similar to a Trumpet</li>
            <li>Great for Jazz Bands</li>
            <li>Lorem ipsum dolor.</li>
            <li>Lorem ipsum.<li>
          </ol>
          <button type="select">Select</button>
      </div>
      </section>
      <footer>
        <ul>
          <li>
            <a href="#" target="_blank">Privacy</a>
          </li>
          <li>
            <a href="#" target="_blank">Terms</a>
          </li>
          <li>
            <a href="#" target="_blank">Contact</a>
          </li>
        <ul>
        <span>Copyright 2016, Original Trombones</span>
      </footer>
    </div>
  </body>
</html>
body {
  background-color: #eee;
font-family: 'Lato', sans-serif;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
#page-layout {
  position: relative;
}
header {
  position: fixed;
  top: 0;
  min-height: 75px;
  padding: 0px 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: #eee;
}
#header-img {
  width: 40vw;
}
nav {
  font-weight: 400;
}
nav > ul {
  width: 35vw;
  display: flex;
  flex-direction: row;
}
li {
  list-style: none;
}
a {
  color: #000;
  text-decoration: none;
}
.container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}
#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 {
  max-width: 275px;
  width: 100%;
  padding: 5px;
}
#hero input[type="submit"] {
  max-width: 150px;
  width: 100%;
  height: 40px;
  padding: 0 20px;
  margin: 15px 0;
  border: 0;
  border-radius: 2px;
  background-color: #f1c40f;
  text-transform: uppercase;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
}
#features {
  margin-top: 30px;
}
.grid {
  display: flex;
}
.desc {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 125px;
    width: 80vw;
    padding: 5px;
}
.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 125px;
  width: 20vw;
  color: darkorange;
}
#How_It_Works {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  padding: 0 20px;
}
#pricing {
  display: flex;
  flex-direction: row;
  margin-top: 60px;
  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 > .card-title {
  background-color: #ddd;
  color: black;
  padding: 15px 0;
  width: 100%;
  text-transform: uppercase;
  font-weight: 700;
}
.product > h3 {
  margin-top: 15px;
}
.product > ol {
  margin: 10px 0;
}
.product > ol > li {
  padding: 5px 0;
}
.product > button {
  max-width: 80px;
  width: 100%;
  height: 30px;
  margin: 15px 0px;
  font-size: 1rem;
  background-color: #f1c40f;
  text-transform: uppercase;
  border: 0;
  border-radius: 2px;
  font-weight: 500;
}
footer {
  padding: 20px;
  margin-top: 30px;
  background-color: #ddd;
}
footer > ul {
  display: flex;
  justify-content: flex-end;
}
footer > ul > li {
  padding: 0 10px;
}
span {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 0.9em;
  color: #444;
}

Your code so far

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.

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/102.0.0.0 Safari/537.36

Challenge: Build a Product Landing Page

Link to the challenge:

1 Like

Hi @dabaymfg

To display elements in one direction flexbox seems the right choice. Check for margin: auto; as well.
This is a link to a Kevin Powell video it might help you:

He has a few ones about flexbox as well. He explains things really good. I also recommend you his course Conquering Responsive Layouts
It is for free. It helps to understand some basic concepts and flexbox. Wes Bos has a free courses about it and about Grid too, all for free.
I hope that helps you. Happy coding! Dont give up :clap: :muscle:

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