Tea Cozy - Gap between navbar and top of page when scrolling

Original: https://www.codecademy.com/paths/web-development/tracks/getting-more-advanced-with-design/modules/layout-with-flexbox/projects/tea-cozy

CSS CODE:

html {
    background-color: black;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 22px;
}

header {
    display: flex;
    width: 100%;
    border-bottom: 1px solid seashell;
    position: fixed;
    background-color: black;
}

header img {
    justify-content: flex-start;
    height: 50px;
    margin-left: 10px;
    align-content: center;
}

ul.navBar{
    display: inline-flex;
    justify-content: flex-end;
    width: 100%;
    list-style: none;
    margin-top: 0px;
    align-items: center;
}

ul.navBar li {
    padding-right: 25px;
}

ul.navBar li a {
    color: seashell;
}

.container {
    background-image: url(https://s3.amazonaws.com/codecademy-content/courses/freelance-1/unit-4/img-mission-background.jpg);
    height: 700px;
    width: 1200px;
}

HTML CODE:

  <!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Tea Shop</title>
    <link href="./css/styles.css" type="text/css" rel="stylesheet">
  </head>
  <body>
    <header>
      <img src="https://s3.amazonaws.com/codecademy-content/courses/freelance-1/unit-4/img-tea-cozy-logo.png">
      <ul class="navBar">
        <li><a href="#">Home</a></li>
        <li><a href="#">Featured Tea</a></li>
        <li><a href="#">Locations</a></li>
      </ul>
    </header>
    <section class="container">
    </section>
  </body>
  </html>

Question: I don’t know how to get rid of the gap between the nav bar and top of the page when scrolling, please help.

Give your body a margin of 0;

body {
  margin: 0;
}
1 Like

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