Bootstrap Grid, do I need a container?

后端 未结 4 953
無奈伤痛
無奈伤痛 2020-11-29 10:24

I\'ve been playing with bootstrap 3 and I noticed that if you use the Grid System without a container it becomes fluid, someone told me I shouldn\'t do that because the syst

相关标签:
4条回答
  • 2020-11-29 10:38

    Update Bootstrap 4

    Rows should also be wrapping in container or container-fluid in Bootstrap 4 to prevent horizontal scolling caused by negative margins on the .row.

    Bootstrap 3

    You should wrap row in container or you'll have a problem with the negative margins that BS 3 uses for the row element. Basically the row is designed to be within a container. Read more on the Bootstrap grid

    Play with this example on Bootply: http://bootply.com/83751

    0 讨论(0)
  • 2020-11-29 10:48

    According to the latest documentation:

    https://getbootstrap.com/docs/4.5/layout/grid/

    it is reasonable to drop the outer container (or at least its css class assignment):

    Need an edge-to-edge design? Drop the parent .container or .container-fluid.

    This appears to have been in the documentation since the 4.0 release: https://getbootstrap.com/docs/4.0/layout/grid/

    0 讨论(0)
  • 2020-11-29 10:52

    I think you need it. Without the container it kind a works - but it shows a horizontal scroll bar at the bottom of the page and around 20px are cut off from rightside of the screen.

    See yourself how it works without the container class - just go to http://getbootstrap.com/ and remove the container class using inspect element.

    0 讨论(0)
  • 2020-11-29 10:53

    Just use the container-fluid class instead of the container class. class="container-fluid" will allow you to use full width.

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