How to properly set the 100% DIV height to match document/window height?

前端 未结 9 1917
难免孤独
难免孤独 2021-01-30 04:53

I have a wrapper positioned to center with an y-repeated background image:


    
...some content
&
9条回答
  •  终归单人心
    2021-01-30 05:25

    simplest way i found is viewport-height in css..

    div {height: 100vh;}
    

    this takes the viewport-height of the browser-window and updates it during resizes.

    see "can i use" for browser compatibility list

提交回复
热议问题