In my React project, I have a container called "answers-container" with multiple buttons inside it, laid out using flexbox with flex-wrap: wrap to allow them to wrap onto the next line when the container width is exceeded.
However, I'm facing an issue where the height of the answers-container does not adjust dynamically based on the number of buttons or when they wrap to the next line. This fixed height causes unexpected behavior:
https://i.sstatic.net/DdZSTgB4.png
As shown in the image, the container almost overlaps the one below it, which is not the desired outcome. I want to maintain a consistent space between the answers container and the container with the buttons below it.
If I can get the height to adjust dynamically, I believe setting a margin-top on the buttons container will solve the issue and maintain a consistent space. Currently, the margin-top is set based on the first line of answers only, leading to overlapping of subsequent lines with the buttons container.
Below is a simplified version of the React component and CSS I am working with:
...