Hi, all.
So I want the heading ‘Playlists’ to grow an shrink with appearing containers. It works fine until the wrap comes into effect, as you can see in the gif
.
I’ve tried all I know of but nothing works. Here’ s my HTML & CSS.
(My mind tells me there’s a javascript based maths answer to this, but not necessarily a CSS one because CSS for its infinite wisdom cannot have a divisor with units)
See, my mind says max-width: calc(100vw - (round(down, 100vw / 410px) * 410px) - ((round(down, 100vw / 410px) - 1) * 30px), but that doesnt work because you cant divide 100vw by 410px. I can divide 100vw by 7 and get a pixel measurement, but not by X pixels and get a number.
My demo will fail if items need to wrap automatically at some point. You can’t shrink the container to match the width of its content when that content has wrapped.
Javascript can do it by calculating the formula above and injecting the value into the CSS (Style? CSS? Is it still CSS if you’re playing with the values at runtime? whatever.)