I have a website that adapts to different screen sizes, featuring a two-column layout in larger browser windows. Currently, the layout is achieved using the float property. However, I want the layout to switch to a single column on smaller screens. In this new configuration, the content from the second column should be displayed between the elements of the main column, as illustrated here:
https://i.sstatic.net/giBKx.png
<div class="two-columns">
<div class="main-column">
<div class="red-element"></div>
<div class="yellow-element"></div>
</div>
<div class="sidebar-column">
<div class="green-element"></div>
</div>
</div>
Although I attempted a flex-box-based solution similar to the one described in this question, the flex-basis
property appears to be unsupported in Safari when used with flex-direction: column
. Ensuring proper support in Safari is crucial since it is the primary browser for my visitors.
Is there a CSS-only method to achieve this layout adjustment without duplicating the green element in the markup?