0

I can't figure out where this 5px gap is coming from.

The white gap in the picture is not a gap between the two divs but is a gap within the banner div. For some reason it goes beyond the height of the picture, any ideas why?

Screenshot

The code is:

#banner {
  width: 100%;
  margin-top: 20px;
  position: relative;
  text-align: center;
  overflow: auto;
}
#banner h2 {
  font-size: 300%;
  text-transform: uppercase;
  color: #fff;
  font-weight: normal;
  margin: 20px;
}
#banner img {
  width: 100%;
}
.banner-title {
  background-color: rgba(0, 0, 0, 0.7);
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
}
.banner-title h2 {
  padding: 0;
  margin: 0;
}
.banner-title p {
  color: #fff;
  margin-top: 0;
  font-size: 120%;
}
.progress-wrapper {
  background-color: #3084bf;
  height: 60px;
  padding: 10px 0;
}
.progress-bar {
  width: 50%;
  margin-left: 25%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-size: 80%;
  padding: 10px 0;
}
.progress-bar-reached {
  background-color: #ffd105;
  height: 40px;
  float: left;
  text-align: center;
}
.progress-bar-remaining {
  background-color: #eaeaea;
  float: right;
}
<div id="banner">

  <img src="http://www.placehold.it/500">

  <div class="banner-title">

    <h2><span class="yellow-text">Pollinate</span> Water</h2>

    <p>A Pollinate Energy project aiming to spread new water filters to another 500 urban poor Indian families</p>

  </div>

</div>

<div class="progress-wrapper">

  <div class="progress-bar">

    <div class="progress-bar-reached" style="width:<?php echo $charityProgress3; ?>%">

      25 Families

    </div>

    <div class="progress-bar-remaining" style="width:<?php echo $charityRemaining3; ?>%">

      500 Families

    </div>

  </div>

</div>
misterManSam
  • 24,303
  • 11
  • 69
  • 89
Danny Santos
  • 1,090
  • 2
  • 10
  • 30
  • 1
    The gap is caused by the images default `display: inline` and `vertical-align:baseline`. Set the `#banner img` to `display: block` *or* use `vertical-align: "top" / "middle" or "bottom"` – misterManSam Jan 19 '15 at 05:19
  • #banner img { width: 100%; display : block; // add this to your code } – Niranth Reddy Jan 19 '15 at 05:34

1 Answers1

0

Try this :

Add this in your css

#banner img {
    display: block;
    width: 100%;
}
anji
  • 344
  • 3
  • 6