Why would you use a Div wrapper in html that contains the same things as body? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why would you use a Div wrapper in html that contains the same things as body?

Basically I see html that has a <body> and right after <div class ="container"> Is placed. It contains the same thing as body. So why wouldn't you just customize body instead of the container.

2nd Dec 2021, 1:20 AM
Golden Gaming player
Golden Gaming player - avatar
3 Answers
+ 3
If there were only one <div>, then it makes little sense. But if there were multiple <div> all sharing the same class, then perhaps the code author thought about + Swapping which one was visible at one time + Ease of CSS style application To name a few ...
2nd Dec 2021, 1:33 AM
Ipang
+ 1
Could you share the concerning code bit so we could look into it together?
2nd Dec 2021, 2:05 AM
Gordon
Gordon - avatar
0
I mean a code like this for example <Body> <Div class = "container" > <p>Hi</p> </Div> </Body>
2nd Dec 2021, 2:13 AM
Golden Gaming player
Golden Gaming player - avatar