So suppose I have a div which is horizontal with many children, I am appending elements to it with JS When there's enough children to fit right by eachother horizontally then do it that way. When there is no ability to fit a new one, make a new row to fill with elements and shrink them. At some point, the elements become too small so keep making new rows without shrinking. Is this an included feature of CSS I do not know about or I would have to do all of this manually through JS?
You can try this using CSS flex with the flex-wrap property.
Here you can see an example: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap