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

前端 未结 8 2201
予麋鹿
予麋鹿 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:17

    Notice how most of these can only be used WITHOUT a DOCTYPE. I'm looking for the same answer, but I have a DOCTYPE. There is one way to do it with a DOCTYPE however, although it doesn't apply to the style of my site, but it will work on the type of page you want to create:

    div#full-size{
        position: absolute;
        top:0;
        bottom:0;
        right:0;
        left:0;
        overflow:hidden;
    

    Now, this was mentioned earlier but I just wanted to clarify that this is normally used with a DOCTYPE, height:100%; only works without a DOCTYPE

提交回复
热议问题