Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap nested columns

I'm trying to nest 2 columns in the second row of a container using the code snippet from the official documentation

When I try the same code, the columns appear as separate rows appearing one after another & not as 2 columns in the same row. What am I doing wrong?

like image 519
Young Monk Avatar asked Dec 30 '25 15:12

Young Monk


1 Answers

You are closing the first column then following it with two new rows when I assume you want the following rows to be nested in the column. The following changes should do what you want, if I am correctly interpreting your needs

<div class="row">
    <div class="col‐sm‐12 col-xs-12" style="background-color:red">
        Level 1: .col‐sm‐9 <!-- Removed </div> -->
        <div class="row">
            <div class="col-sm-6 col-xs-8"  style="background-color:yellow">
                Level 2: .col‐xs‐8 .col‐sm‐6 bs bs bs bs bs bs bs 
            </div>
            <div class="col-sm-6 col-xs-4"  style="background-color:grey">
                Level 2: .col‐xs‐4 .col‐sm‐6
            </div>
        </div> 
        <div class="row"> 
            <div class="col-sm-6 col-xs-8" style="background-color:yellow">
                Level 3a: .col‐xs‐8 .col‐sm‐6  bs bs bs bs bs bs bs  bs bs bs bs bs bs bs 
            </div>
            <div class="col-sm-6 col-xs-4" style="background-color:grey">
                Level 3b: .col‐xs‐4 .col‐sm‐6
            </div>
        </div>
    </div><!-- Added -->
</div>
like image 151
ndonohoe Avatar answered Jan 03 '26 10:01

ndonohoe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!