-1

There's a small gap between the header section and the image, how can I get rid of it? Is there some kind of default margin? The banner has the image in it.

html,
body {
  font-family: Bahnschrift;
  font-size: 13;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
}

header {
  width: 100%;
  height: 108px;
  background-color: #001e22;
}

img {
  margin-top: 17px;
}

nav {
  float: right;
  margin-top: 35px;
}

li {
  font-size: 18px;
  display: inline-block;
  margin-left: 48px;
}

a {
  color: white;
  text-decoration: none;
}

.banner {
  width: 100%;
  height: 500px;
}
<header>
  <div class="wrap">
    <img src="logo.png">
    <nav>
      <ul>
        <li><a href="">CONTACT US</a></li>
        <li><a href="">SOFTWARE USED</a></li>
        <li><a href="">PROJECT</a></li>
        <li><a href="">ABOUT US</a></li>
        <li><a href="">HOME</a></li>
      </ul>
    </nav>
  </div>
</header>

<section class="banner">
  <img src="building.png" alt="banner">
</section>
Pete
  • 57,112
  • 28
  • 117
  • 166
  • 2
    because you have a blanket margin on all images: `img { margin-top: 17px; }` Always try to target elements through classes otherwise you will end up with expensive selectors and issues like this – Pete Dec 04 '18 at 13:31

1 Answers1

1

Your img selector is also putting a margin on the image in the main body, so you need to be more specific (e.g. with header > img)

html,
body {
  font-family: Bahnschrift;
  font-size: 13;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
}

header {
  width: 100%;
  height: 108px;
  background-color: #001e22;
}

header > img {
  margin-top: 17px;
}

nav {
  float: right;
  margin-top: 35px;
}

li {
  font-size: 18px;
  display: inline-block;
  margin-left: 48px;
}

a {
  color: white;
  text-decoration: none;
}
Zudo
  • 481
  • 3
  • 19