I've been tearing my hair out for awhile with this one and I feel like it must be so much easier than I'm making it. I want to resize a div based on the number of elements that will fit inside of a given page width.
For example, if my page width is 1000px, and I have three elements side by side that are 300px each, which are all in a separate container, I'd like to make the container 900px and center that inside the page. If my page width went down to 700px, then the container would be resized at 600px, etc.
Math-wise, it would be something like this:
round(100% / 300px) * 300px
but I've had absolutely no luck getting something like that to even calculate properly.