Use screen.width inside calc (css)

Is there any use of scree.width inside calc? Something like that:

left: calc(250px + screen.width - 1024px)!important;

For a specific situation where @media (max-width: 1024px) will not work.

+4
source share
3 answers

100vw = 100% of the width of the viewport

left:calc(250px + 100vw - 1024px)!important;
+3
source

You can use units vwto measure dimensions relative to the width of the viewport, so try the following:

left: calc(250px + 100vw - 1024px) !important;
0
source

left: calc(250px + 100vw - 1024px)!important;this probably won't work, I would do it like this: calc(100vw - 774px);(1024 - 250 = 774)

vw - view width

0
source

Source: https://habr.com/ru/post/1683347/


All Articles