Make body have 100% of the browser height

后端 未结 21 1388
离开以前
离开以前 2020-11-22 00:26

I want to make body have 100% of the browser height. Can I do that using CSS?

I tried setting height: 100%, but it doesn\'t work.

I want to set

21条回答
  •  青春惊慌失措
    2020-11-22 00:32

    Please check this:

    * {margin: 0; padding: 0;}    
    html, body { width: 100%; height: 100%;}
    

    Or try new method Viewport height :

    html, body { width: 100vw; height: 100vh;}
    

    Viewport: If your using viewport means whatever size screen content will come full height fo the screen.

提交回复
热议问题