This is hard to achieve. When you have a relative parent with absolute children inside, they cannot influence the size of the parent div.
You should also use relatives. Why are the controls located absolutely?
But when CSS doesn't work, JavaScript comes to the rescue. So it can be solved.
source share