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

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

    Use the HTML

    Your content goes here.

    and use the CSS:

    html, body {margin:0;padding:0;height:100%;}
    #full-size {
        height:100%;
        width:100%;
        position:absolute;
        top:0;
        left:0;
        overflow:hidden;
    }
    #wrapper {
        /*You can add padding and margins here.*/
        padding:0;
        margin:0;
    }
    

    Make sure that the HTML is in the root element.

    Hope this helps!

提交回复
热议问题