Last active
June 15, 2017 08:14
-
-
Save Swimburger/8bc22abcf55f891ed44b1a39546d9f34 to your computer and use it in GitHub Desktop.
calculate grid item width
This file contains 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
function getWidth(width, spacing, amountOfColumns){ | |
return (width - (spacing * (amountOfColumns - 1))) / amountOfColumns; | |
} | |
console.log(getWidth(921, 10, 3)); | |
console.log(getWidth(921, 10, 2)); | |
console.log(getWidth(921, 10, 1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment