title: Why if a div contains an image that div do not have height?
body: <p>I am trying to do the following page:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta charset = "utf-8"&gt;
          &lt;link href="estiles.css" type="text/css" rel="stylesheet"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div&gt;
              &lt;h1&gt; GALERY OF IMAGES&lt;/h1&gt;
          &lt;/div&gt;
          &lt;div id = "leftDiv"&gt;
              hola
          &lt;/div&gt;
  
          &lt;div id = "galery"&gt;
              &lt;div id = "centerGalery"&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;img class = "imageGalery" src = "http://marcus.ridoutfamily.co.uk/wp-content/uploads/2013/08/78186357b7074a1a3bda5d3c0ed4a2e0.jpg"&gt;&lt;/div&gt; 
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>in which I have a header and two <code>divs</code>, one on the left and one on the right. Each one of the divs have 50% of the width of the body. Here there is any problem.</p>
  
  <p>The problems comes when I want to add some images as a galery of photos in the div that it is on the right of the body. I want that all the images will be centered inside <code>galery</code> div but I could not achieve that (I created a new div that holds all the images). As opposed, I saw that the divs in which I have stored each image do not have height. </p>
  
  <p>Is it normal? How, if the image it is contained inside the div, the div do not have height?</p>
  
  <p>Here is my CSS: </p>
  
  <pre><code>body{
      text-align: center;
      margin: 0px;
      padding: 0px;
  }
  
  #leftDiv{
      float: left;
      width: 50%;
      background-color: green;
  }
  
  #galery{
      float: right;
      width: 50%;
      background-color: blue;
  }
  
  #centerGalery{
      width: 100%;
      margin: 0 auto;
  }
  
  .imageGalery{
      height: 100px;
      width: 100px;
      float: left;
  }
  </code></pre>
  
  <p>Here it is what I mean:</p>
  
  <p><a href="https://i.stack.imgur.com/qGqzv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qGqzv.png" alt="enter image description here"></a>
  Thanks in advance!</p>