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

流过昼夜 提交于 2019-11-27 04:02:14
CodeFanatic

The statistic is clearly and it is a fair assessment, in my point of view.

I think the decision has to be made by you. If you want to future-proof your website using the latest greatest technology, but are aware that there are currently some downfalls, then great, go for it.

If you are not prepared to invest a little more into your online presence, then stick to the old way, which is in no means wrong.

EDIT: When I want to create a responsive design I start developing for Mobile Devices first and then create the Desktop Version, to ensure that my viewports all work correctly, since the Mobile support is lacking at some points(especially vmax). BUT about this you could ask 50 guys and the chances that they all will say something else are pretty good.

user1473054

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

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

and CSS:

.element {height: 100vh;}

Viewport units are great but most mobile browser vendors managed to make vh unusable in practice.

When you start scrolling or change scrolling direction, the address bar will either disappear or come back; then you stop, release your finger and the vh value will suddenly be updated alongside any element using it resulting in a UX nightmare (user not expecting anything to resize at the end of scrolling, changing proportions of existing elements, re-layout of content, etc).

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.

Well, you can see it's already there for desktop browsers, and support on mobile devices is quite limited. So it actually depends on whether you want to create a site that looks good on computers, or a more compatible pixel-based site that works on phones too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!