Why should I use a container div in HTML?

前端 未结 9 1698
陌清茗
陌清茗 2020-12-23 14:33

I have noticed a common technique is to place a generic container div in the root of the body tag:


  
    ...
  
  <         


        
9条回答
  •  滥情空心
    2020-12-23 15:11

    THis method allows you to have more flexibility of styling your entire content. Effectivly creating two containers that you can style. THe HTML Body tag which serves as your background, and the div with an id of container which contains your content.

    This then allows you to position your content within the page, while styling a background or other effects without issue. THink of it as a "Frame" for the content.

提交回复
热议问题