Here's a simplified version of my CSS:
h1 {
font-size: 3rem;
line-height: calc(1.5 * (100vw - 50) + 2);
}
The calculation for line-height doesn't work. It has something to do with the 100vw
, but I'm not sure what. My understanding is that 100vw
should be converted into 100% of the pixels of the current viewport (e.g. 414 ... so the math should be: 1.5 * (414 - 50) + 2
).
If the vw
unit is removed, then the calculation works (i.e. 1.5 * (100 - 50) + 2
). What's going on here? Why isn't 100vw
working?
Here's my Fiddle: https://jsfiddle.net/wv68au4o/1/