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

前端 未结 6 1514
庸人自扰
庸人自扰 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:09

    The page you have linked to answers your question really.

    It depends what browsers you need to support.

    Partial support in IE9 refers to supporting "vm" instead of "vmin". Partial support in iOS7 is due to buggy behavior of the vh unit. All other partial support refers to not supporting the "vmax" unit.

    This states that using viewport units could be 'buggy' in iOS7. I wouldn't recommend using viewport units, but instead use:

    • Pixles : e.g. height: 500px;
    • Percentage : e.g. height: 50%;

    These values are widely supported and will produce the best results.

提交回复
热议问题