Container div


#1

What is the reasoning for having container divs under nav and jumbotron?
Should container be on top of each one of those?


#2

We call where the container divs are positioned as INSIDE their parent divs.

    <div class="nav">
      <div class="container">
      ... your nav code goes in here
      </div> <!-- ends container -->
    </div> <!-- ends nav -->

    <div class="jumbotron">
      <div class="container">
      ... your jumbotron code goes in here
      </div> <!-- ends container -->
    </div> <!-- ends jumbotron -->

Having those container divs will help you style the content without affecting the parent divs. When you get to the Bootstrap exercises you will see that Bootstrap makes use of containers.


#3

Thank you. I assumed since I've seen many examples of container divs that surround the entire body of a div, that they were supposed to be outside of the parent div.


#4

You can use them in both ways. It depends on the outcome you are looking for.


#5

Thanks again!
I saw the significance of container placement when I went through the bootstrap exercises. My initial confusion stemmed from the fact that I thought the container was supposed to "contain" the div & not vice versa. Before using code academy, I was always taught container 1st, then div. It's taking awhile but I think i'm getting it.