Skip to content

Instantly share code, notes, and snippets.

@serhiinkh
Created February 24, 2015 22:22
Show Gist options
  • Save serhiinkh/2e21c57a09526b3a62d8 to your computer and use it in GitHub Desktop.
Save serhiinkh/2e21c57a09526b3a62d8 to your computer and use it in GitHub Desktop.
Columns generator
for(var i = 1, max = 6; i < max; i++) {
for(var f = i + 1; f < 7; f++) {
columns = i;
margin = (f - 1) * 4;
width = (100 - margin) / f;
if (columns > 1) {
width = (width * columns) + ((columns - 1) * 4);
}
console.log(i + '/' + f + ' col: width:' + Math.floor(width * 1000) / 1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment