This issue is a really common one and I'm about to get it solved for a customer. I have 100% width to work with, and I got X columns that should span equally (sum up to 100%). Browsers handle decimals in percent values differently, so I want to create an algorithm that finds the optimal total percentage (within a threshold, say 95% - 100%) that creates the total minimum decimals per column.
- The algorithm needs to find the optimal percentage within a threshold
- X column classes should be generated, and should be included in the calculation when looking for the optimal percentage (i.e.
.col-1 { width: 10%; } .col-2 { width: 20%; }
[...])