Getting bootstrap col to work

前端 未结 2 1186
傲寒
傲寒 2021-01-27 13:02

I have a group of links that i want to evenly space out that should also be mobile responsive. I cant seem to get them to corporate.

code associated with it:

相关标签:
2条回答
  • 2021-01-27 13:36

    Since you have 14 elements (assumed this is a fixed qty), you can't use Bootstrap grid systen, unless you make three rows with 4+4+3 elements, or 6+6+2. Otherwise, you can put lists inside rows, like this, and use Bootstrap class .list-inline for Bootstrap 3.x inline list:

    <div class="row">
        <div class="col-sm-12 col-md-12 col-lg-12">
            <ul class="list-inline">
                <li>/* 7 <li> elements */</li>
            </ul>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12 col-md-12 col-lg-12">
            <ul class="list-inline">
                <li>/* 7 <li> elements */</li>
            </ul>
        </div>
    </div>
    

    Remember that .row adds padding to the div, so do your fixes.

    If you want to use Grid system, you can use following code:

    <div class="row">
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-2">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-4 col-sm-offset-2"> /* add offset to center the two elements*/
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
        <div class="col-sm-4 ">
            <a href="#" ...><img ...><span ...> TEXT </span></a>
            <div class="modal fade" ... >MODAL</div>
        </div>
    </div>
    
    0 讨论(0)
  • 2021-01-27 13:39

    Change your ul#menu li to have a display:inline-block and add a width (PX or %)

    0 讨论(0)
提交回复
热议问题