CSS: Are view height (vh) and view width (vw) units widely supported?

前端 未结 6 1513
庸人自扰
庸人自扰 2020-11-30 04:01

I\'m using 100vh to center a div vertically with line-height. This site puts support for vh and vw at around 70%, is that a fair assessment? Would you recommend using viewpo

6条回答
  •  渐次进展
    2020-11-30 04:27

    use both CSS vh and jQuery, it's safer.
    jQuery example:

    var clientHeight = $( window ).height();
      $('.element').css('height', clientHeight);
    

    and CSS:

    .element {height: 100vh;}
    

提交回复
热议问题