html - height not adding height to a empty div -


hey guys new bootstrap , have following html ::

<div class="col-md-6 clients">      <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>       <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>  </div> 

now after 1st 3 col-xs-4 want vertical space , did following :

<div class="col-md-6 clients">      <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>      <div class="image-separator"></div>      <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>     <div class="col-xs-4"><img src="img/1.jpg" alt="" class="img-responsive"></div>  </div> 

notice div <div class="image-separator"></div> , gave following css :

.image-separator {     height: 20px; } 

surprisingly no vertical space create , played around bit , added following styles :

.image-separator {     height: 20px;     width: 100%;     float: left; } 

this did work , why did jsut height:20px not work ? curious , taught come here on , ask , can please explain , love learn how css works , asking , new css . fiddle here.

note:: not looking solve problem , solved , trying understand why happens !

thank you.

it didn't work before because bootstrap columns have floating value: float:left , have clear floating:

clear: both 

added css of spacer

.image-separator {     height: 20px;     clear: both; } 

i'm editing answer because forgot bootstrap has class clear floating elements more eficiently: clearfix.


Comments

Popular posts from this blog

angularjs - Redirect to a new template in angular js -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -