html - Why I can't applied spacing between two divs -
i have 5 div, , between first , second have spacing set on button2 class margin-top:10px; that's applied between second , first div, why don't have spacing between thrid , second ... don't know why have little spacing between third , fourth divs.
jsfiddle: http://jsfiddle.net/avggqr02/
html
<div class="contactdiv"><div class="ppdiv"> <button class="ppenvelope"><img src="http://i.imgur.com/qu5cvxc.jpg" alt="slika"></button><button class="pptext"><span class="pptext2">privatna poruka</span></button> </div><!--zatvoren ppdiv--><div class="button2"> <button class="ppenvelope"><img src="http://i.imgur.com/qu5cvxc.jpg" alt="slika"></button><button class="pptext"><span class="pptext2">privatna poruka</span></button> </div><!--zatvoren button2--><div class="button2"> <button class="ppenvelope"><img src="http://i.imgur.com/qu5cvxc.jpg" alt="slika"></button><button class="pptext"><span class="pptext2">privatna poruka</span></button> </div><!--zatvoren button2--><div class="button2"> <button class="ppenvelope"><img src="http://i.imgur.com/qu5cvxc.jpg" alt="slika"></button><button class="pptext"><span class="pptext2">privatna poruka</span></button> </div><!--zatvoren button2--><div class="button2"><button class="ppenvelope"><img src="http://i.imgur.com/qu5cvxc.jpg" alt="slika"></button><button class="pptext"><span class="pptext2">privatna poruka</span></button> </div><!--zatvoren button2--> </div><!--zatvoren contactdiv-->
css:
.contactdiv{ width:271px; } .ppdiv{ overflow: hidden; margin-top:20px; margin-left: 20px; } .ppenvelope, .pptext { float: left; border: none; height: 48px; } .ppenvelope{ border-top-left-radius: 4px; border-bottom-left-radius: 4px; background: #b2d4dd; } .ppdiv img{ padding:10px; } .button2 img{ padding:10px; } .pptext{ border-top-right-radius: 4px; border-bottom-right-radius: 4px; background: #c9e0e6; color:#4c6974; } .pptext2{ display: inline-block; color:#4c6974; padding-top: 13px; padding-bottom:13px; padding-left: 13px; padding-right: 13px; } .button2{ margin-top: 10px; margin-left:20px; }
you have floating elements inside, need clear fix.
.button2 { overflow: auto; }
http://jsfiddle.net/avggqr02/1/
or use clear fix hack.
.button2:after { clear: both; content: ""; display: table; }
Comments
Post a Comment