Why do we always put two <div>s around a box?


Hi everyone,

I am not shure if this is the right section. I noticed this in the "make a website" section where you recreate the airBNB website, but it did not show me a subsection for this project on the discussion board...


in this lesson we always used thwo divs to "wrap up" the parts of the website. like

<div class="whatever">
   <div class="container">

Unfortunately, during the HTML/CSS lessons I did not get familiar with this concept. Of course, I get to know divs and classes and that you put one into another, but I just dont understand why it is common practice to wrap things up into two divs.

Can someone please explain this to me?


The whatever class is for you, you can apply styling to it. The container class is a bootstrap class. So that is why you nest multiply divs, because otherwise you can't distinguish between the different containers. I sometimes nest even more divs, if i want to position something in a precies


Thank you for your answer.

I actually dont know what bootstrap is. I dont think it was contained in the HTML/CSS course and also not mentioned before in the "make a website" execrise.

Is it but possible, that bootstrap has something to do with your website staying in shape across multiple browsers or just inside a browser if you resize the window?


Oops, i seem to given half an answer. The course you are currently taking is working towards bootstrap, bootstrap is a css framework making it easier for you to build websites. Part of bootstrap is something called a grid system. This helps you to make your website staying in shape across different devices and re-sizing of windows.

Edit: and again i forget stuff. Container is used to centralize elements if the screen gets larger then 1200px, look at this example, you will see the div centralize if larger then 1000px (i wrote this container, bootstrap contains something very similar)