Is there a way to set variable font-weight in viewport units? Like
`font-weight: 60vw;`
Or
`font-weight: calc(60vw);`
?
Why not?
/cc @fantasai @davidbaron @Litherum @gregwhitworth @jpamental @djrrb @clagnut
#ampersandconf
5
17
It’s because it needs a unit less value for weight, so that calc results in a vw or px unit being added. But there is work going on in the CSSWG on an update to calc to enable that!
1
1
I think that if you multiply the cake by 1% as a last operation it will end up as a percent, but I haven’t had a chance to test that...
1
1
Nope.
Firefox & Safari:
`font-stretch: calc(50*1%)` works.
`font-stretch: calc(50vw*1%)` fails.
Neither works in Chrome, even `font-stretch: 50%` fails.
Edge, mystery box since there’s no Edge for Mac.
Hm.
2
1
The resolution to do this was from 2014 (or maybe earlier; we resolved to do it multiple times before the spec was edited), but the spec changes were actually made recently in github.com/w3c/csswg-drafts/… .
Jul 1, 2018 · 7:56 PM UTC
2



