Search code examples
htmlcsstwitter-bootstrapmaterialize

What is the best practice with containers? When is using multiple containers a good idea or not?


I am using Materialize CSS to create a homepage. I usually use one container to hold everything. This time, I used different containers to hold different elements, for instance, one for the navigation bar, one for the carousel, and so on. There are no containers within containers.

Is this good to do? What is the best practice with containers?


Solution

  • Some times using multiple containers is ok and even required. For example think of page with multiple full width element, which contains different background color and centered content. These full width elements could be <section>s and centered content could be containers.

    You have to think is your solution logical. If you can figure reason for your element to have it's own container, then it is ok to use. If you provide link to your work, i could give my opinion.

    As clear answer to your question, i think it is good to use multiple containers if page structure requires. Container is just one element among the others.