how to make a full screen div, and prevent size to be changed by content?

前端 未结 8 2200
予麋鹿
予麋鹿 2020-12-13 13:05

for my web application, i would like the main div to be full screen (both width and height = 100%), and regardless of content, i want it to stay at that size. that means, if

8条回答
  •  [愿得一人]
    2020-12-13 13:35

    Or even just:

    Your contents go here
    html,body{ margin:0; padding:0; height:100%; width:100%; }
    #full-size{
      height:100%;
      width:100%;
      overflow:hidden; /* or overflow:auto; if you want scrollbars */
    }
    

    (html, body can be set to like.. 95%-99% or some such to account for slight inconsistencies in margins, etc.)

提交回复
热议问题