2

I have an img and div i can't find why there is a gap. I have seen so question. But it is not working for me i have also tried using margin:0. here is my My fiddle. But i cant find why this gap is here. Thanks

<img src="http://www.kidsmathgamesonline.com/images/pictures/shapes/rectangle.jpg" class="header"/>         
<div class="body-middle">

</div>

css is:-

.header
{
width:100%;     
height:auto;
padding:0px;
margin:0px;
}

.body-middle
{
height:50px;
width:100%;
margin:0 auto;  

background:url('http://www.clipartsfree.net/vector/large/simple_green_rectangle_Vector_Clipart.png') 0 0 repeat;
background-size:contain;
background-position:center top;
}
Community
  • 1
  • 1
Ashoka Mondal
  • 1,161
  • 4
  • 12
  • 28

3 Answers3

3

Give display:block to the image.

.header{
    display:block;
}

Updated fiddle here.

codingrose
  • 15,563
  • 11
  • 39
  • 58
0
.body-middle {
    margin-top: -50px; //adjust number of pixels to what works best for you
}
CRABOLO
  • 8,605
  • 39
  • 41
  • 68
-1

Try This CSS..

*{
 margin:0;
}

DEMO

Sridhar R
  • 20,190
  • 6
  • 38
  • 35