The Catch : My solution should a) only use CSS, b) not depend on media queries, and c) work for any combination of elements at different sizes.
To test, drag the edges of each colored block in the demo below to resize them: