How to make a structure with divs of the same id

1

Well, lately I've seen in many templates, that a div with the same id, takes different places in space. I, as I have little knowledge of CSS, wanted to do something that looks like this:

Thatis,adivwiththesameidtakes4placesontop,andinthe"5th" place, automatically goes down and the structure repeats itself until there are divs ...

How can I do this?

    
asked by anonymous 04.11.2016 / 17:35

1 answer

3

First, a ID has this name because it means that it is a single reference, to create an identifier for all your div s, you should use classe , an example of what you requested could be done as follows:

#container {
  width: 600px;
  height: 600px;
}

.float {
  width: 20%;
  height: 50px;
  margin: 10px 1% 0;
  float: left;
  border: 1px solid #000;
}
<div id="container">
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
    <div class="float">  
    </div>
</div>
  
    
04.11.2016 / 17:47