I am terrible at math, this is css/sass related, but it's mainly a math question. I feel like the answer is very easy. You can see for example col-1 is 100% / 12 which gives me the width one column should be in a 12 column grid.
I am not sure how to calculate for example 5 columns because it does not divide by 12. What is the appropriate formula for numbers that don't divide by 12 evenly?
.col-1 {
width: (100% / 12);
}
.col-2 {
width: (100% / 6);
}
.col-3 {
width: (100% / 4);
}
.col-4 {
width: (100% / 3);
}
.col-5 {
width: (100% / ?);
}
.col-6 {
width: (100% / 2);
}
.col-7 {
width: (100% / ?);
}
.col-8 {
width: (100% / ?);
}
.col-9 {
width: (100% / ?);
}
.col-10 {
width: (100% / ?);
}
.col-11 {
width: (100% / ?);
}
.col-12 {
width: (100% / 1);
}
Divide $12$ by the given divisor on a calculator anyway.
So $12/5=2.4$, $12/7=1.714$ (approx.), $12/8=1.5$ and so on.
Your answers will come in decimals, so if the program can not handle them, it can't be implemented so simply (you may have to take decimal containers and round them off first).
A more well-written form of this code would be to use a loop and 2 counters, so you don't need to manually type values beforehand.
Lastly, neither is this a proper maths question (as it's far too basic), nor a proper SE one (as it shows no research or understanding); post them on the main SE if you have to.