Created
October 22, 2019 10:16
-
-
Save dpaluy/745a155d742f6056cd4a1f926a1250c3 to your computer and use it in GitHub Desktop.
Calculate Responsive CSS with Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| s0 = 375.0; x0 = 14.0 | |
| s1 = 1920.0; x1 = 90.0 | |
| v = ((x0 - x1) * 100) / (s0 - s1) | |
| p = x0 - ((s0 / 100) * v) | |
| puts "calc(#{p.round(2)}px + #{v.round(2)}vw)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment