Parent container with overflow not changing height based on child elements

Hello, im trying to make a slider with 4 divs that changes between them. Inside of these divs there are 4 other divs which should contain an image and some text. I managed to do the script and to change them between them.
But i have a problem with overflow, the main container doesn't change it's height in anyway. I want it to change its height responsive to the child elements and remove the Y scroll. I tryed to use overflow-x and overflow-y auto but nothing. Maybe if i put some screenshoots it will be easier to understand. Only way to change its height is if i expresively write it. If i remove the height it should nothing. How does this annoy me? I want to use it on a homepage as a last uploaded products that shows the last 16 products. I could put a bigger height, but depending on the title text from the database it may overflow or look bad.
1.PNG
2.PNG
3.PNG
4.PNG
Was this page helpful?