I'm looking for a creative way of doing responsive layout without media query.
Let's say I have a row of two boxes. First one has min width of 400px. Second one has min width of 200px. The gap between them is fixed width 60px.
If the container is larger than 660px, then two boxes should expand proportionally. If the container is less than 660px, then the second box should go to next line, and both boxes' widths should be 100%.
I almost got it with css flexbox. See here. Except that when the container is less than 660px, the first box's width doesn't expand to 100% (because of fixed margin-right: 60px
).
I know it's easy to achieve with media query or some css frameworks like bootstrap, but I want to see if it's possible without media query.
I've been looking into flexbox and css grid for such possibility but no success. Any help is appreciated.
EDIT:
The reason behind this is that I want to build a responsive layout based on the container's width, not viewport's width. Element Query solves this but it's not implemented in major browsers yet.