If I use .container-fluid in Bootstrap 3, does that mean I need to use grid classes?

后端 未结 3 1189
醉话见心
醉话见心 2021-01-26 05:29

I\'ve read several of the SO answers to what .container and .container-fluid are, but what I am missing is simple. Do I use column classes like col-xs

相关标签:
3条回答
  • 2021-01-26 06:11

    Containers exist mostly to 1) limit page width and 2) provide padding for rows. Fluid containers only do the latter. If you aren't using rows, you may not need containers. However, if you're using columns you should be using rows and containers for better, more controllable structure.

    0 讨论(0)
  • 2021-01-26 06:13

    The container-fluid is used to contain the grid (row + col-*) but can be used for other things such as headings, tables, etc..

    So no, container-fluid is not a replacement for columns, it's a holder of columns. The only difference between container-fluid and container is that the container is not full-width on larger screens. The container is a fixed width that's centered with large margins on the sides. container-fluid doesn't resize, it's always 100% width. Container demo

    If you want to use the responsive grid (rows and columns), you need to use container or container-fluid like this..

    <div class="container-fluid">
        <div class="row">
            (one or more col-*-* here)
        </div>
    </div>
    

    Or

    <div class="container">
        <div class="row">
            (one or more col-*-* here)
        </div>
    </div>
    

    Read this article for a complete explanation.

    0 讨论(0)
  • 2021-01-26 06:13

    Yes, you can because the .container-fluid is used as container but the difference is in responsive sizes.

    see: Container-fluid vs .container

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