No replies
Last seen: 7 years 37 weeks ago
Timezone: GMT+2
Joined: 2008-11-30
Posts: 16
Points: 17


I want to get evenly divs inside another div. I have this code:

<div class="container">
  <div class="contained one">fsdaa</div>
  <div class="contained two">fsdaa</div>

.container {
  background: red;
  width: 500px;
  height: 200px;
.contained {   
 -webkit-box-sizing: border-box;
 -moz-box-sizing: border-box;
  box-sizing: border-box;
  width: 45%;
  margin: 2.5%;
  float: left;
  padding: 10px;
.one {
  background: blue;
  background: green;

My question: in that way I have now, when I resize the side margins of the contained divs, I have to change also the width of those divs. For me this is a bit stupid, because I think changing the margins should be enough, because after changing the margin, the divs should adapt its width automatically (that's my idea).

Do you understand me? Am I doing something wrong to get those evenly divs or my approach is correct?