calc() with viewport units in media query on supported browsers

為{幸葍}努か 提交于 2019-12-11 22:08:09

问题


Using calc() in a media query in Chrome (version 68) seems to replace viewport units with px. Eg

@media only screen and (min-height: calc(100vw + 10px))

results in

@media only screen and (min-height: 110px)

Firefox handles it correctly and IE, Edge and Safari which doesn't support calc() in media queries (according to mozilla) seems to ignore the query which is better for my use case.

How can I apply the media query + calc() in the browsers that properly supports it? Should I expect Firefox to continue supporting calc() this way?

Use case: In a game on a square canvas that fills the viewport, a signature should appear in the lower right corner of either the canvas (default) or the viewport depending on the available space.

Demo: https://codepen.io/LoveF/pen/PBjXwr

来源:https://stackoverflow.com/questions/51522724/calc-with-viewport-units-in-media-query-on-supported-browsers

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