Styling HTML and BODY selector to height: 100%; vs using 100vh

后端 未结 3 417
后悔当初
后悔当初 2020-12-04 11:55

My brother and I were messing around in sublime earlier and he suddenly shout out, \"I learned something new!\"

A little shocked, I asked, \"What\'s that..?\"

<
3条回答
  •  佛祖请我去吃肉
    2020-12-04 12:34

    View port units = vw, vh, vmin, and vmax - are based on the size of the browser viewport. Because, their actual size changes depending on the Viewport Size, this makes them great units for responsive design

    Note: When dealing with widths, the % unit is more suitable but with heights, the vh unit is better.

    the width of the viewport will actually be larger than the width of the html element.

    Viewport > html > body

提交回复
热议问题