My goal is to determine which container, among several <divs>
, each containing multiple child <divs>
of varying sizes, has the smallest amount of space covered by the child elements.
<div class="container" id="first">
<div class="small">This is a message</div>
<div class="medium">This is a message</div>
<div class="large">This is a message</div>
</div>
<div class="container" id="second">
<div class="large">This is a message</div>
<div class="large">This is a message</div>
<div class="large">This is a message</div>
</div>
Sample styles:
.container { width: 1000px; height: 1000px }
.small { width: 100px; height: 50px }
.medium { width: 200px; height: 100px }
.large { width: 400px; height: 200px }
Background: On a notice board platform where users can post messages (child <div>
) within parent containers (<div>
), I aim to identify the container with the most free space.
I require assistance with the algorithm, as I am confident in my ability to code it afterward.