Search code examples
htmltwitter-bootstrapgrid-layout

Bootstrap Grid layout good practice


I have a question about grid on part of my page, what is better practice to do, in case where I have multiple xx-12 columns in proximity, where my question is not about alignment or breakpoints but of child-parent relations of rows and cols..

<div class="col-xx-12">
<div class="row">
<div class="col-xx-12">something</div>
<div class="col-xx-12">something</div>
<div class="col-xx-12">something</div>
</div>
</div>

or

<div class="col-xx-12">
<div class="row">
<div class="col-xx-12">something</div>
</div>
<div class="row>
<div class="col-xx-12">something</div>
</div>
<div class="row>
<div class="col-xx-12">something</div>
</div>
</div>
</div>

Solution

  • First is the better option for practice because in this you don't have to repeat your part of code several time like: * starting the class="row".

     <div class="row">
                <div class="col-xx-12">something</div>
                <div class="col-xx-12">something</div>
                <div class="col-xx-12">something</div>
     </div>