Multiple and/or nested Bootstrap containers?

  1. Some sections of the page will span the full viewport width and others won't. Some backgrounds will be the full width but the content won't.

    An example of this is a featurette area which has a background image or color that is the full width of the viewport but the content inside that, forms or whatever, don't exceed the .container at any given viewport width.

  2. You don't nest .container or .container-fluid -- see the docs. It's not necessary.

    Docs: Bootstrap requires a containing element to wrap site contents and house our grid system. You may choose one of two containers to use in your projects. Note that, due to padding and more, neither container is nestable [neither means that .container and .container-fluid are NOT to be nested].


In the Layout section of the 4.3 docs, https://getbootstrap.com/docs/4.3/layout/overview/#containers, it now states

While containers can be nested, most layouts do not require a nested container.

Just be aware of what others have stated about padding, etc.


Unlike what some have said, you can nest a container-fluid inside a container. There is even an example on the official bootstrap website:

http://getbootstrap.com/examples/navbar/