Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Responsive grid with Bootstrap

lmnu

Coder
Hi,
I have a list of 18 items. When I am in sm I would like one column of 18 items, in md two columns of 9 items and xl three columns of 6 items.

HTML:
 <div class='row'>
                            <div class='col-xl-4 col-md-6 col-sm-12'>
                                <ul>
                                    <div>Items01</div>
                                    <div>Items02</div>
                                    <div>Items03</div>
                                    <div>Items04</div>
                                    <div>Items05</div>
                                    <div>Items06</div>
                                </ul>
                            </div>
                            <div class='col-xl-4 col-md-6 col-sm-12'>
                                <ul>
                                    <div>Items07</div>
                                    <div>Items08</div>
                                    <div>Items09</div>
                                    <div>Items10</div>
                                    <div>Items11</div>
                                    <div>Items12</div>
                                </ul>
                            </div>
                            <div class='col-xl-4 col-md-6 col-sm-12'>
                                <ul>
                                    <div>Items13</div>
                                    <div>Items14</div>
                                    <div>Items15</div>
                                    <div>Items16</div>
                                    <div>Items17</div>
                                    <div>Items18</div>
                                </ul>
                            </div>
                        </div>

With "sm" and "xl" no problem but in "md" I have a first column of 12 items and the second of 6 items.
How can I have two columns with the same number of items?

Thank you for your help
 
Finally I found a solution, I don't know if it is the right one but it works.
I give it for information:
HTML:
<div class="container">
        <div class="d-none d-lg-block">
            <div class="row">
                <div class="col-4">Items01</div>
                <div class="col-4">Items02</div>
                <div class="col-4">Items03</div>
                <div class="col-4">Items04</div>
                <div class="col-4">Items05</div>
                <div class="col-4">Items...</div>
            </div>
        </div>
        <div class="d-none d-md-block d-lg-none">
            <div class="row">
                <div class="col-6">Items01</div>
                <div class="col-6">Items02</div>
                <div class="col-6">Items03</div>
                <div class="col-6">Items...</div>
            </div>
        </div>
        <div class="d-sm-block d-md-none d-lg-none">
            <div class="row">
                <div class="col-12">Items01</div>
                <div class="col-12">Items02</div>
                <div class="col-12">Items03</div>
                <div class="col-12">Items04</div>
                <div class="col-12">Items05</div>
                <div class="col-12">Items...</div>
            </div>
        </div>
    </div>
 
Back
Top Bottom